計算機外文文獻+翻譯(.net).doc_第1頁
計算機外文文獻+翻譯(.net).doc_第2頁
計算機外文文獻+翻譯(.net).doc_第3頁
計算機外文文獻+翻譯(.net).doc_第4頁
計算機外文文獻+翻譯(.net).doc_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

東北石油大學本科畢業(yè)設(shè)計英文文獻及翻譯 學院計算機與信息技術(shù)學院班級計科07-1班學號070702140124姓名王東指 導 教 師袁文翠職 稱副教授東北石油大學本科畢業(yè)設(shè)計(英文文獻及翻譯)ASP.NET 技術(shù)1.構(gòu)建 ASP.NET 頁面ASP.NET 和ASP.NET結(jié)構(gòu)ASP.NET 是微軟.NET framework整體的一部分, 它包含一組大量的編程用的類,滿足各種編程需要。 在下列的二個部分中, 你如何學會 ASP.NET 很適合的放在.NET framework, 和學會能在你的 ASP.NET 頁面中使用語言。.NET類庫假想你是微軟。 假想你必須支持大量的編程語言-比如 Visual Basic 、 C# 和 C+. 這些編程語言的很多功能具有重疊性。 舉例來說,對于每一種語言,你必須包括存取文件系統(tǒng)、與數(shù)據(jù)庫協(xié)同工作和操作字符串的方法。此外,這些語言包含相似的編程構(gòu)造。 每種語言,舉例來說,都能夠使用循環(huán)語句和條件語句。 即使用 Visual Basic 寫的條件語句的語法不與 用C+ 寫的不一樣,程序的功能也是相同的。最后,大多數(shù)的編程語言有相似的數(shù)據(jù)變量類型。 以大多數(shù)的語言,你有設(shè)定字符串類型和整型數(shù)據(jù)類型的方法。舉例來說, 整型數(shù)據(jù)最大值和最小值可能依賴語言的種類,但是基本的數(shù)據(jù)類型是相同的。對于多種語言來說維持這一功能需要很大的工作量。 為什么繼續(xù)再創(chuàng)輪子? 對所有的語言創(chuàng)建這種功能一次,然后把這個功能用在每一種語言中豈不是更容易。.NET類庫不完全是那樣。 它含有大量的滿足編程需要的類。舉例來說,.NET類庫包含處理數(shù)據(jù)庫訪問的類和文件協(xié)同工作,操作文本和生成圖像。 除此之外,它包含更多特殊的類用在正則表達式和處理Web協(xié)議。.NET framework,此外包含支持所有的基本變量數(shù)據(jù)類型的類,比如:字符串、整型、字節(jié)型、字符型和數(shù)組。最重要地, 寫這一本書的目的, .NET類庫包含構(gòu)建的 ASP.NET 頁面的類。然而你需要了解當你構(gòu)建.NET頁面的時候能夠訪問.NET framework 的任意類。理解命名空間正如你猜測的, .NET framework是龐大的。 它包含數(shù)以千計的類(超過 3,400) 。幸運地,類不是簡單的堆在一起。.NET framework的類被組織成有層次結(jié)構(gòu)的命名空間。ASP Classic Note在先前的ASP中,你僅僅能夠訪問五個標準類。相比之下 ASP.NET 提供超過 3,400個類!一個命名空間包含一組邏輯的類。舉例來說,涉及到與文件系統(tǒng)協(xié)同工作的類就集合在System.IO 命名空間中。命名空間被組織成一個層次結(jié)構(gòu)(一棵邏輯樹) 。 樹根就是SYSTEM 命名空間。 這個命名空間包含基本的數(shù)據(jù)類型的所有的類,例如:字符串、數(shù)組,還包含提供隨機數(shù)字和日期的類。你通過完整的類的命名空間能唯一識別任何的類在.NET framework中的位置。 舉例來說,指定找到一個the File class 類,按如下操:System.IO.文件System.IO指命名空間 ,而文件指定特定的類。提示你能夠瀏覽.NET Framework所有的標準類的命名空間。通過.NET Framework 的參考文檔可以瀏覽類庫。標準的 ASP.NET 命名空間在默認情況下,在你的ASP.NET頁面中,類被包含在一個選定的命名空間中這些默認的命名空間使你在ASP.NET中最常用到的。System 命名空間- 包含所有的基本數(shù)據(jù)類型和其他有用的類,例如:那些關(guān)于產(chǎn)生隨機數(shù)字和日期的類。System.Collections命名空間- 包含的類是標準的集合類,例如:哈希表,數(shù)組列表。System.Collections.Specialized 命名空間- 包含特殊的集合類,例如:連接列表和字符串集合。 System.Configuration 命名空間- 包括Web.config files類。System.Text命名空間-包含編碼,解碼和操作字符串內(nèi)容的類。System.Text.RegularExpressions命名空間- 包含的是匹配正則表達式和替代操作類。System.Web 命名空間-工作在萬維網(wǎng)方面包含的是瀏覽器請求和服務器響應的類。System.Web.Caching 命名空間- 包含頁面緩沖內(nèi)容和自定義緩沖操作的類。System.Web.Security命名空間- 包含執(zhí)行驗證和授權(quán),例如:窗體和密碼驗證的類。System.Web.SessionState命名空間- 包含執(zhí)行保存狀態(tài)的類。System.Web.UI命名空間- 包含構(gòu)建 ASP.NET 頁面的用戶接口的類。 System.Web.UI.HTMLControls命名空間- 包含 HTML 控件的類。System.Web.UI.WebControls命名空間- 包含Web控件的類。.NET Framework -可用的語言這一本書的目的, 你將會為以 Visual Basic 作為你的編程語言來完成你的 ASP.NET 頁寫程序編寫。 它是 ASP.NET 頁面的默認語言。雖然你在這一本書中一直用 Visual Basic, 但是,你也需要了解用其它的支持公共語言庫的語言創(chuàng)建ASP.NET頁面。除此之外,這包括 C#, JScript.NET和C+ 。提示本書所含的光碟包含 C# 源代碼。除微軟之外的公司產(chǎn)生的幾十個其他的語言已經(jīng)能夠和.NET framework兼容。 這些其他的語言的一些例子包括 Python、 SmallTalk 、 Eiffel和 COBOL。這就意味著假如你真的想, 你可以使用 COBOL 寫 ASP.NET 頁面。不管你使用什么語言開發(fā) ASP.NET 頁面,你需要明白ASP.NET在執(zhí)行前必須編譯,這就意味著ASP.NET執(zhí)行速度非???。你第一次請求 ASP.NET 頁面, 頁面被編譯成一個.NET類, 這個類文件被保存在一個特殊的目錄下這個目錄的名字叫Temporary ASP.NET Files。對于一個ASP.NET頁面一個通信類文件出現(xiàn)在Temporary ASP.NET Files目錄下。以后不管任何時候你請求那個同樣的ASP.NET頁面,那個通信類文件就會執(zhí)行。當 ASP.NET 頁面被編譯的時候,它沒被直接地被編譯成機器碼而是被編譯成了一個中間語言,名字叫 (MSIL)所有.NET可用的語言都被編譯成這種中間語言。一個ASP.NET 頁面不會被編譯成本地機器碼直到它被一個瀏覽器訪問,在那個時間點包含在Temporary ASP.NET Files目錄下的類文件用JIT編譯器編譯并且執(zhí)行。這些迷惑的方面體現(xiàn)在整個過程都在后臺運行,你必須要做的是用資源代碼為你的ASP.NET頁面創(chuàng)建一個文本文件。.NET framework 為你處理完轉(zhuǎn)換它為編譯碼這一困難工作。典型ASP提示VBScript 怎么樣呢? 在 ASP.NET 之前, VBScript 是開發(fā)動態(tài)頁面最流行的語言。ASP.NET 不支持VBScript ,而且這是好消息。 Visual Basic 是一個 VBScript 的超集,意味著 Visual Basic 相對于 VBScript有更多的功能。 因此, 你用 Visual Basic 有更豐富的函數(shù)和語句供你使用。此外,不像 VBScript , Visual Basic 是一種被編譯的語言。 這意味著如果你使用 Visual Basic 重寫相同的 VBScript代碼感覺會更容易一些。假如你過去只用VBScript而不用 Visual Basic,也不用擔心。 因為 VBScript 如此接近 Visual Basic, 你將會發(fā)現(xiàn)在這二種語言之間的轉(zhuǎn)變是很容易的。提示在.NET framework中,微軟包括一個名叫 IL Disassembler的有趣的工具。在臨時的ASP.NET文件目錄中你能使用這個工具查看沒有裝配的ASP.NET 類的代碼。 它列出了類的所有方法和屬性使你能夠瀏覽中間代碼。正如在這章討論的這個工具也可以用于操作ASP.NET控件。 舉例來說,你能使用 IL Disassembler 瀏覽 TextBox 控件的中間代碼。(位于在一個叫做 System.Web.dll 的文件中)介紹 ASP.NET 控件ASP.NET 控件為你的Web應用程序提供動態(tài)和交互的用戶接口。這些控件能夠使你的網(wǎng)站的使用者看見和交互。 舉例來說,你能使用控件建立 HTML 窗體元素,交互式日歷, 而且可以滾動標題廣告。ASP.NET 控件和 HTML 內(nèi)容共存。 典型地,你用通常的 HTML 創(chuàng)建你的網(wǎng)頁的靜態(tài)區(qū)域和用 ASP.NET 控件創(chuàng)建網(wǎng)頁的動態(tài)區(qū)域。了解 ASP.NET 控件是怎么工作的?最好的方法是看一個簡單的Web應用窗體頁面。添加ASP.NET頁面的代碼第二個難點就是ASP.NET頁面的代碼,他是確切的頁面的程序代碼,在你添加的程序用戶處理控件也頁面事件。如果一個使用者單擊 HTML窗體中的Button按鈕, 舉例來說,那個按鈕就會響應一個事件 (單擊事件) 。 典型地,你想添加代碼響應這個事件到頁面中。 舉例來說,當某人單擊Button按鈕控件的時候,你可以保存窗體數(shù)據(jù)到一個文件或者數(shù)據(jù)庫??丶皇俏ㄒ坏哪芟鄳录氖挛铩?當它被請求的時候一個ASP.NET 頁面每次都能夠響應幾個事件。 舉例來說,每當你請求一個頁面,頁面的初始化事件就會被觸發(fā)。 每當初始化事件發(fā)生的時候,你能夠添加代碼到頁面中來執(zhí)行。2. 用Web服務器控件創(chuàng)建窗體構(gòu)建靈活窗體你用幾個基本W(wǎng)eb控件來代替標準的 HTML 窗體元素,例如radio buttons、text boxes, and list boxes. 你能夠用這些控件為你的Web應用程序在你的ASP.NET頁面中創(chuàng)建用戶界面。 下面的部分為這些Web控件提供了詳細的提綱和程序源代碼??刂祈撁鏋g覽在下列的部分中,你學會如何控制一個用戶從一個ASP.NET頁面轉(zhuǎn)到另一個頁面。首先,你學會怎么把一個HTML窗體鏈接到另一個頁面來獲取信息。 下一步,你學會用Redirect()方法自動讓一個用戶瀏覽一個新的頁面。 最后,你學會用超級鏈接控件怎么把頁面連在一起。對控件應用格式在下列的部分中,你學會該如何創(chuàng)建更有吸引力的Web窗體。 首先,你瀏覽一下針對所有Web控件格式屬性他們是基本控件類的格式屬性。 然后,你學會在Web控件上應用樣式表風格。3. 用驗證控件做頁面驗證使用客戶端驗證傳統(tǒng)地,當增加驗證到他們的頁面中時,他們會面臨一個嚴峻的選擇。 你可以添加窗體頁面驗證規(guī)則到你的服務器端代碼,或者是添加驗證規(guī)則到你的客戶端代碼。寫驗證代碼到客戶端代碼中的優(yōu)勢能夠及時反饋到你的用戶。 舉例來說,一個使用者忽略在一個要求檢驗的字段中輸入一個值,你能夠及時的顯示一個錯誤信息而不需要返回到服務器端解決。人們喜歡客戶端的驗證。 它看起來很棒而且產(chǎn)生一種比較好的效果。 然而,問題是它不與所有的瀏覽器兼容。 不是所有的瀏覽器支持 JavaScript、不同版本的瀏覽器的不同版本支持 JavaScript,所以客戶端驗證沒有保障。由于這個原因,許多開發(fā)者在過去決定添加自定義驗證到服務器端。因為服務器端代碼能夠和任何瀏覽器協(xié)同工作。就這樣的做法更有安全的保障。幸運地,正如在章節(jié)討論的這些驗證控件不會強迫你做困難的選擇。 這些驗證控件會自動地產(chǎn)生客戶端代碼和服務器端代碼。 如果一個瀏覽器有能力支持JavaScript ,客戶端的驗證腳本將會自動返回到瀏覽器。 如果一個瀏覽器不支持 JavaScript,那個驗證規(guī)則會自動在服務器端代碼中執(zhí)行。然而你需要注意的是,客戶端的驗證僅僅能夠工作在IE4.0或更高的版本。 尤其,正如這一章討論的客戶端腳本不可能在任意本本的瀏覽器中運行。控制字段: RequiredFieldValidator 控件你用這個控件來檢查在一個Web窗體中是否為空, 典型地,你和 TextBox 控件一起使用這個控件。 然而,這個控件也可以用在其他的輸入型控件,例如:RadioButtonList.控件。驗證表達式: RegularExpressionValidator 控件你能使用 RegularExpressionValidator 控件來驗證輸入的值是否和定義的正則表達式相匹配。 例如:你能使用這控件來檢查一個用戶是否輸入一個合法的電子郵件地址,電話號碼,用戶名或密碼。怎樣用一個正則表達式來完成這些驗證任務將會在下面的例子中一一列出。 比較值: CompareValidator 控件這個CompareValidator 控件用于比較一個輸入的數(shù)據(jù)和另外一個值是否相同。另外一個值可能是固定值,例如:一個特定的數(shù)字或者是輸入到另一個控件中的一個值??偨Y(jié)錯誤: ValidationSummary 控件假想一個頁面有50個字段假如你僅僅用上部分討論的那些驗證控件來顯示錯誤看見一個錯誤在頁面中將是很難的。 例如:你可能需要滾動到第48個頁面字段來找到這個錯誤信息。幸好,微軟除了包含上面提到的控件還包括 ValidationSummary 控件。 你能用這控件綜合所有的錯誤信息在一個頁面的上端或者你想要的任何一個地方。4. 先進的控件編程保存瀏覽狀態(tài)默認地,幾乎所有的 ASP.NET 控件都會在先前的窗體中保留他們的屬性值。 舉例來說,如果你輸入文本到一個Lebel標簽上然后提交那個頁面,當那個頁面再次被訪問那個Lebel標簽的內(nèi)容將會被保存下來。瀏覽狀態(tài)的妙處是它不依賴任何的特定服務器或瀏覽器的屬性。 尤其,它不依賴cookies, session變量、或應用程序變量。 瀏覽狀態(tài)在一個名叫做VIEWSTATE的隱藏頁面中執(zhí)行,這個隱藏頁面自動創(chuàng)建每個Web窗體。當靈活的應用時, 瀏覽狀態(tài)能夠在你的網(wǎng)站中產(chǎn)生藝術(shù)性的和積極的效果,例如:如果你在一個支持瀏覽狀態(tài)的控件中顯示數(shù)據(jù)庫數(shù)據(jù),你不需要每次都返回到需要反饋到服務器的數(shù)據(jù)庫頁面。 你能夠自動地保存頁面里的數(shù)據(jù)狀態(tài)。顯示和隱藏內(nèi)容假想你正在用一個可選擇的部分創(chuàng)造頁面。 舉例來說,假想你正在創(chuàng)造一種在線納稅系統(tǒng),而且你想要顯示或者隱藏一個包含適用于已婚的稅文件編檔員的問題的部分?;蛘? 假想你想要添加一個幫助按鈕到網(wǎng)站上去。 你可能想要隱藏或者顯示完成依靠用戶參考的問題的詳細說明。最后,假想你想要把一個tax form 變成很多頁面,以便一個人每次只看那個tax form的一部分。在下列的部分中,你學會用屬性設(shè)置在一個窗體中來隱藏或顯示控件。 你學會用單個控件和一組控件設(shè)置Visible and Enabled屬性來隱藏和顯示頁面內(nèi)容。使用Visible and Enabled屬性每個控件,包括 HTML 和Web控件,有一個Visible 屬性來決定那個控件是否可見。 當一個控件的Visible是false值,那個控件就不會在頁面上顯示;那個控件也不會進一步運行。Web控件 (不是每個HTML 控件) 還有一個叫Enabled的屬性。當Enabled的屬性是false值,你用的瀏覽器是IE4.0或更高的版本那個控件被封住了,也不起作用了,當用其他的瀏覽器的時候,如:網(wǎng)景瀏覽器那個控件不會被封,但它也是不起作用的。使瀏覽狀態(tài)失效在特定的環(huán)境中,你可能想要對一個單獨的控件或ASP.NET頁面作為一個整體的瀏覽狀態(tài)失效。 舉例來說, 你可能使用一個有包含許多數(shù)據(jù)的控件.(假想一個RadioButtonList 控件控制1,000 個選項)假如你擔心頁面數(shù)據(jù)會大大的降低頁面的顯示速度,你可能不想要加載數(shù)據(jù)到隱藏的VIEWSTATE頁面字段。使用豐富頁面的控件在下列的部分中,你學會在ASP.NET Framework怎樣使用三種特征控件。學會該如何使用日歷控件顯示交互式日歷,AdRotator控件顯示滾動的廣告,HTMLInputFile控件來接受文件的上傳。 麥克唐納、茲普茲塔著ASP.NET 3.5高級程序設(shè)計(第2版)ASP.NET Technique1. Building ASP.NET PagesASP.NET and the .NET FrameworkASP.NET is part of Microsofts overall .NET framework, which contains a vast set of programming classes designed to satisfy any conceivable programming need. In the following two sections, you learn how ASP.NET fits within the .NET framework, and you learn about the languages you can use in your ASP.NET pages.The .NET Framework Class LibraryImagine that you are Microsoft. Imagine that you have to support multiple programming languagessuch as Visual Basic, JScript, and C+. A great deal of the functionality of these programming languages overlaps. For example, for each language, you would have to include methods for accessing the file system, working with databases, and manipulating strings.Furthermore, these languages contain similar programming constructs. Every language, for example, can represent loops and conditionals. Even though the syntax of a conditional written in Visual Basic differs from the syntax of a conditional written in C+, the programming function is the same.Finally, most programming languages have similar variable data types. In most languages, you have some means of representing strings and integers, for example. The maximum and minimum size of an integer might depend on the language, but the basic data type is the same.Maintaining all this functionality for multiple languages requires a lot of work. Why keep reinventing the wheel? Wouldnt it be easier to create all this functionality once and use it for every language?The .NET Framework Class Library does exactly that. It consists of a vast set of classes designed to satisfy any conceivable programming need. For example, the .NET framework contains classes for handling database access, working with the file system, manipulating text, and generating graphics. In addition, it contains more specialized classes for performing tasks such as working with regular expressions and handling network protocols.The .NET framework, furthermore, contains classes that represent all the basic variable data types such as strings, integers, bytes, characters, and arrays.Most importantly, for purposes of this book, the .NET Framework Class Library contains classes for building ASP.NET pages. You need to understand, however, that you can access any of the .NET framework classes when you are building your ASP.NET pages.Understanding NamespacesAs you might guess, the .NET framework is huge. It contains thousands of classes (over 3,400). Fortunately, the classes are not simply jumbled together. The classes of the .NET framework are organized into a hierarchy of namespaces.ASP Classic NoteIn previous versions of Active Server Pages, you had access to only five standard classes (the Response, Request, Session, Application, and Server objects). ASP.NET, in contrast, provides you with access to over 3,400 classes!A namespace is a logical grouping of classes. For example, all the classes that relate to working with the file system are gathered together into the System.IO namespace.The namespaces are organized into a hierarchy (a logical tree). At the root of the tree is the System namespace. This namespace contains all the classes for the base data types, such as strings and arrays. It also contains classes for working with random numbers and dates and times.You can uniquely identify any class in the .NET framework by using the full namespace of the class. For example, to uniquely refer to the class that represents a file system file (the File class), you would use the following:System.IO.FileSystem.IO refers to the namespace, and File refers to the particular class.NOTEYou can view all the namespaces of the standard classes in the .NET Framework Class Library by viewing the Reference Documentation for the .NET Framework.Standard ASP.NET NamespacesThe classes contained in a select number of namespaces are available in your ASP.NET pages by default. (You must explicitly import other namespaces.) These default namespaces contain classes that you use most often in your ASP.NET applications:System Contains all the base data types and other useful classes such as those related to generating random numbers and working with dates and times.System.Collections Contains classes for working with standard collection types such as hash tables, and array lists.System.Collections.Specialized Contains classes that represent specialized collections such as linked lists and string collections.System.Configuration Contains classes for working with configuration files (Web.config files).System.Text Contains classes for encoding, decoding, and manipulating the contents of strings.System.Text.RegularExpressions Contains classes for performing regular expression match and replace operations.System.Web Contains the basic classes for working with the World Wide Web, including classes for representing browser requests and server responses.System.Web.Caching Contains classes used for caching the content of pages and classes for performing custom caching operations.System.Web.Security Contains classes for implementing authentication and authorization such as Forms and Passport authentication.System.Web.SessionState Contains classes for implementing session state.System.Web.UI Contains the basic classes used in building the user interface of ASP.NET pages.System.Web.UI.HTMLControls Contains the classes for the HTML controls.System.Web.UI.WebControls Contains the classes for the Web controls.NET Framework-Compatible LanguagesFor purposes of this book, you will write the application logic for your ASP.NET pages using Visual Basic as your programming language. It is the default language for ASP.NET pages. Although you stick to Visual Basic in this book, you also need to understand that you can create ASP.NET pages by using any language that supports the .NET Common Language Runtime. Out of the box, this includes C#, JScript.NET, and the Managed Extensions to C+.NOTEThe CD included with this book contains C# versions of all the code samples.Dozens of other languages created by companies other than Microsoft have been developed to work with the .NET framework. Some examples of these other languages include Python, SmallTalk, Eiffel, and COBOL. This means that you could, if you really wanted to, write ASP.NET pages using COBOL.Regardless of the language that you use to develop your ASP.NET pages, you need to understand that ASP.NET pages are compiled before they are executed. This means that ASP.NET pages can execute very quickly.The first time you request an ASP.NET page, the page is compiled into a .NET class, and the resulting class file is saved beneath a special directory on your server named Temporary ASP.NET Files. For each and every ASP.NET page, a corresponding class file appears in the Temporary ASP.NET Files directory. Whenever you request the same ASP.NET page in the future, the corresponding class file is executed.When an ASP.NET page is compiled, it is not compiled directly into machine code. Instead, it is compiled into an intermediate-level language called Microsoft Intermediate Language (MSIL). All .NET-compatible languages are compiled into this intermediate language.An ASP.NET page isnt compiled into native machine code until it is actually requested by a browser. At that point, the class file contained in the Temporary ASP.NET Files directory is compiled with the .NET framework Just in Time (JIT) compiler and executed.The magical aspect of this whole process is that it happens automatically in the background. All you have to do is create a text file with the source code for your ASP.NET page, and the .NET framework handles all the hard work of converting it into compiled code for you.ASP CLASSIC NOTEWhat about VBScript? Before ASP.NET, VBScript was the most popular language for developing Active Server Pages.ASP.NET does not support VBScript, and this is good news. Visual Basic is a superset of VBScript, which means that Visual Basic has all the functionality of VBScript and more. So, you have a richer set of functions and statements with Visual Basic.Furthermore, unlike VBScript, Visual Basic is a compiled language. This means that if you use Visual Basic to rewrite the same code that you wrote with VBScript, you can get better performance.If you have worked only with VBScript and not Visual Basic in the past, dont worry. Since VBScript is so closely related to Visual Basic, youll find it easy to make the transition between the two languages.NOTEMicrosoft includes an interesting tool named the IL Disassembler (ILDASM) with the .NET framework. You can use this tool to view the disassembled code for any of the ASP.NET classes in the Temporary ASP.NET Files directory. It lists all the methods and properties of the class and enables you to view the intermediate-level code.This tool also works with all the ASP.NET controls discussed in this chapter. For example, you can use the IL Disassembler to view the intermediate-level code for the TextBox control (located in a file named System.Web.dll).Introducing ASP.NET ControlsASP.NET controls provide the dynamic and interactive portions of the user interface for your Web application. The controls render the content that the users of your Web site actually see and interact with. For example, you can use controls to create HTML form elements, interactive calendars, and rotating banner advertisements.ASP.NET controls coexist peacefully with HTML content. Typically, you create the static areas of your Web pages with normal HTML content and create the dynamic or interactive portions with ASP.NET controls.The best way to understand how ASP.NET controls work in an HTML page is to look at a simple Web Forms Page.Adding Application Logic to an ASP.NET PageThe second building block of an ASP.NET page is the application logic, which is the actual programming code in the page. You add application logic to a page to handle both control and page events.If a user clicks a Button control within an HTML form, for example, the Button control raises an event (the Click event). Typically, you want to add code to the page that does something in response to this event. For example, when someone clicks the Button control, you might want to save the form data to a file or database.Controls are not the only things that can raise events. An ASP.NET page itself raises several events every time it is requested. For example, whenever you request a page, the pages 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 ControlsBuilding Smart FormsYou 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 ASP.NET pages to create the user interfac

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論