- What is the main difference between the Button server control and the Button HTML control?
When clicked, the Button server control triggers an ASP.NET Click event procedure on the server. The Button HTML control triggers the event procedure indicated in the button’ s onclick attribute, which runs on the client.
- How do you get several RadioButton controls to interoperate on a Web form so that only one of the RadioButtons can be selected at once?
Set the GroupName property of each RadioButton to the same name.
- Why does ASP.NET perform validation on both the client and the server?
Client-side validation helps avoid round trips to the server. Validating on the client makes sure that the data is valid before it is submitted, in most cases. However, because validation might be turned off (or maliciously hacked) on the client, data must be revalidated on the server side. This provides full assurance that the data is valid while avoiding as many round trips as possible.
- What types of validation would you use to verify that a user entered a valid customer number?
You would use a RequiredFieldValidator and a RegularExpressionValidator. If you have access to a list of expected customer numbers, you could replace the RegularExpressionValidator with a CustomValidator that checked the list.
- What is wrong with the following line of code?
Visual Basic .NET
You can’ t use the Transfer method with HTML pages. It works only with .aspx pages.
- Why can’ t you open a new browser window from within server code?
Server code executes on the server, whereas the new window is created on the client. You need to use client-side code to do things that affect the client, such as upload files, display new windows, or navigate back in history.