计算机专业毕业外文翻译--aspnet技术-jsp程序(编辑修改稿)内容摘要:

s that can raise events. An page itself raises several events every time it is requested. For example, whenever you request a page, the page39。 s Load event is triggered. You can add application logic to the page that executes whenever the Load event occurs. 2. Building Forms with Web Server Controls Building Smart Forms You use several of the basic Web controls to represent standard HTML form elements such as radio buttons, text boxes, and list boxes. You can use these controls in your pages to create the user interface for your Web application. The following sections provide detailed overviews and programming samples for each of these Web controls. Controlling Page Navigation In the following sections, you learn how to control how a user moves from one page to another. First, you learn how to submit an HTML form to another page and retrieve form information. Next, you learn how to use the Redirect() method to automatically transfer a user to a new page. Finally, you learn how to link pages together with the HyperLink control. Applying Formatting to Controls In the following sections, you learn how to make more attractive Web forms. First, you look at an overview of the formatting properties mon to all Web controls。 they are the formatting properties of the base control class. Next, you learn how to apply Cascading Style Sheet styles and classes to Web controls. 3. Performing Form Validation with Validation Controls Using Clientside Validation Traditionally, Web developers have faced a tough choice when adding form validation logic to their pages. You can add form validation routines to your serverside code, or you can add the validation routines to your clientside code. The advantage of writing validation logic in clientside code is that you can provide instant feedback to your users. For example, if a user neglects to enter a value in a required form field, you can instantly display an error message without requiring a roundtrip back to the server. People really like clientside validation. It looks great and creates a better overall user experience. The problem, however, is that it does not work with all browsers. Not all browsers support JavaScript, and different versions of browsers support different versions of JavaScript, so clientside validation is never guaranteed to work. For this reason, in the past, many developers decided to add all their form validation logic exclusively to serverside code. Because serverside code functions correctly with any browser, this course of action was safer. Fortunately, the Validation controls discussed in this chapter do not force you to make this difficult choice. The Validation controls automatically generate both clientside and serverside code. If a browser is capable of supporting JavaScript, clientside validation scripts are automatically sent to the browser. If a browser is incapable of supporting JavaScript, the validation routines are automatically implemented in serverside code. You should be warned, however, that clientside validation works only with Microsoft Inter Explorer version and higher. In particular, the clientside scripts discussed in this chapter do not work with any version of Netscape Navigator. Requiring Fields: The RequiredFieldValidator Control You use RequiredFieldValidator in a Web form to check whether a control has a value. Typically, you use this control with a TextBox control. However, nothing is wrong with using RequiredFieldValidator with other input controls such as RadioButtonList. Validating Expressions: The RegularExpressionValidator Control You can use RegularExpressionValidator to match the value entered into a form field to a regular expression. You can use this control to check whether a user has entered, for example, a valid address, telephone number, or username or password. Samples of how to use a regular expression to perform all these validation tasks are provided in the following sections. Comparing Values: The CompareValidator Control The CompareValidator control performs parisons between the data entered into a form field and another value. The other value can be a fixed value, such as a particular number, or a value entered into another control. Summarizing Errors: The ValidationSummary Control Imagine that you have a form with 50 form fields. If you use only the Validation controls discussed in the previous sections of this chapter to display errors, seeing an error message on the page might be difficult. For example, you might have to scroll down to the 48th form field to find the error message. Fortunately, Microsoft includes a ValidationSummary control with the Validation controls. You can use this control to summarize all the errors at the top of a page, or wherever else you want. 4. Advanced Control Programming Working with View State By default, almost all controls retain the values of their pro。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。