TAILIEUCHUNG - ASP.NET 4 Unleased - p 11

Chú ý Khi sử dụng Internet Explorer, bạn có thể cấu hình AutoComplete bằng cách chọn Tools, Internet Options, nội dung, và nhấp vào nút AutoComplete. Các ASP. NET Framework không hỗ trợ tính năng AutoComplete cho các trình duyệt khác như FireFox hay Opera. | 74 CHAPTER 2 Using the Standard Controls AutoCompleteType LastName Runat server br br asp Button id btnSubmit Text Submit Runat server div form body html FIGURE Using AutoComplete with the TextBox control. NOTE When using Internet Explorer you can configure AutoComplete by selecting Tools Internet Options Content and clicking the AutoComplete button. The ASPNET Framework does not support AutoComplete for other browsers such as FireFox or Opera. Finally the TextBox control supports the Focus method. You can use the Focus method to shift the initial form focus to a particular TextBox control. By default no form field has focus when a page first opens. If you want to make it easier for users to complete a form you can set the focus automatically to a particular TextBox control contained in a form. From the Library of Wow eBook Accepting User Input 75 For example the page in Listing sets the focus to the first of two form fields. LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD script runat server void Page_Load script html xmlns http 1999 xhtml head id Head1 runat server title TextBox Focus title head body form id form1 runat server div asp Label id lblFirstName Text First Name AssociatedControlID txtFirstName Runat server br asp TextBox id txtFirstName AutoCompleteType FirstName Runat server br br asp Label id lblLastname Text Last Name AssociatedControlID txtLastName Runat server br asp TextBox id txtLastName AutoCompleteType LastName Runat server br br asp Button 2 From the Library of Wow eBook 76 CHAPTER 2 Using the Standard Controls id btnSubmit Text Submit Runat server div form body html In Listing the Page_Load event handler sets the form focus to the txtFirstName TextBox control. NOTE You can also set the form focus by setting either the method or the server-side HtmlForm control s DefaultFocus .