Server Controls

Barker

New Member
Hi,<BR><BR>I'm new to ASP.NET and reading some articles about server controls. What I understood is with ASP.NET we can associate controls (like textbox, buttons) with server. In the server-side code we can get the property values just like VB. This is good. But can we really replace HTML controls with server controls in all occasions ? With regular ASP page ( with JavaScript for client-side) we validate the controls without reloading the page. If I'm correct with server controls we have to reload the page to validate any user entered information. Is this a good practice ?<BR><BR>THANKS1) Yes you are right. You associate them with the server side. I have not seen any controls you cannot replace, just remember to embed the runat="server" attribute. Some names have changed, and some not. Like if you want to have an upload field, it is more or less the same as normal HTML:<BR><BR><input type="file" id="upload" Runat="server" /><BR><BR>A difference here is that you NEED to have runat server. The server maintains a table so it is easy for you to access the different controls on your page. To access this one, you simply type:<BR><BR>upload.MethodName()<BR><BR>2) It is not all true, what you write about the validation on server side. MS have given us some controls called validation controls. From these you are able to validate information, on server AS WELL AS ON CLIENT. This is very important. You are here able to write code once, and the app will test it on both on the server and on the client - of cause with the choice of disabling one or both of them. If you really want, you can write your own client validation, but this in visual basic. Hope this was enough information.
 
Back
Top