![外文翻譯aspnet概述_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-5/14/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc1.gif)
![外文翻譯aspnet概述_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-5/14/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc2.gif)
![外文翻譯aspnet概述_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-5/14/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc3.gif)
![外文翻譯aspnet概述_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-5/14/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc4.gif)
![外文翻譯aspnet概述_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-5/14/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc/c96fddd5-f6d7-4c0d-a705-e51d325b9dfc5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上畢業(yè)設(shè)計(論文)外文資料翻譯題 目: 概述 院系名稱: 信息科學(xué)與工程學(xué)院 專業(yè)班級: 計算機科學(xué)與技術(shù)05級6班 學(xué)生姓名: 學(xué) 號: 指導(dǎo)教師: 教師職稱: 起止時間: 地 點 附 件: 1.外文資料翻譯譯文;2.外文原文。 指導(dǎo)教師評語:外文資料的選擇與畢業(yè)設(shè)計內(nèi)容密切相關(guān),文章具有一定的難度,但譯文能夠較好的表達(dá)出原文的思想。專業(yè)術(shù)語運用比較準(zhǔn)確,語句通順,文字?jǐn)?shù)量符合要求。不足之處在于個別語句的翻譯缺乏潤色,有些牽強??傊g文符合要求,反映出學(xué)生具有較好的專業(yè)外文閱讀和翻譯能力。 簽名: 2009年 3 月 2 日概述當(dāng)ASP第一次發(fā)布時,Web編程還比較
2、困難,因為需要IIS來處理ASP頁。后來,和Visual Studio2005通過引入網(wǎng)站開發(fā)模型使一切工作都變得容易了。借助該網(wǎng)站模型,您不必在Visual Studio 中創(chuàng)建新項目,而是可以指向一個目錄并開始編寫網(wǎng)頁和代碼。此外,您還可以使用內(nèi)置的 Development Server快速測試站點, Development Server將寄宿在一個本地進(jìn)程中,并消除了必須安裝IIS才能進(jìn)行開發(fā)這一先決條件。下面從不同的方面來介紹技術(shù)。類庫是微軟.NET framework整體的一部分,它包含一組大量編程用的類,滿足各種編程需要。因為Visual Basic、JScript和C+這些編程語
3、言的很多功能具有重疊性。舉例來說,對于每一種語言,你必須包括存取文件系統(tǒng)、與數(shù)據(jù)庫協(xié)同工作和操作字符串的方法。此外,這些語言包含相似的編程構(gòu)造。都能夠使用循環(huán)語句和條件語句。即使用Visual Basic寫的條件語句的語法和用C+的不一樣,程序的功能也是相同的。對于多種語言來說維持這一功能需要很大的工作量。那么對所有的語言創(chuàng)建這種功能一次,然后把這個功能用在每一種語言中豈不是更容易。然而.NET類庫不完全是那樣。它含有大量的滿足編程需要的類。舉例來說,.NET類庫不僅包含處理數(shù)據(jù)庫訪問的類和文件協(xié)同工作,操作文本和生成圖像,而且還包含更多特殊的類用在正則表達(dá)式和處理Web協(xié)議。此外.NET f
4、ramework,也包含支持所有的基本變量數(shù)據(jù)類型的類,比如:字符串、整型、字節(jié)型、字符型和數(shù)組。.NET framework是龐大的。它包含數(shù)以千計的類。(超過3,400)幸運地是,類不是簡單的堆在一起。.NET framework的類被組織成有層次結(jié)構(gòu)的命名空間。一個命名空間包含一組邏輯的類。舉例來說,涉及到與文件系統(tǒng)協(xié)同工作的類就集合在命名空間中。命名空間被組織成一個層次結(jié)構(gòu)(一棵邏輯樹)。樹根就是SYSTEM命名空間。這個命名空間包含基本的數(shù)據(jù)類型的所有的類,例如:字符串、數(shù)組,還包含提供隨機數(shù)字和日期的類。你通過完整的類的命名空間能唯一識別任何的類在.NET framework中的位
5、置。例如,指定找到一個the File class類,按如下操作:.文件指命名空間,而文件指定特定的類。在默認(rèn)情況下,在你的頁面中,類被包含在一個選定的命名空間中這些默認(rèn)的命名空間使你在中最常用到的。System命名空間-包含所有的基本數(shù)據(jù)類型和其他有用的類,例如:那些關(guān)于產(chǎn)生隨機數(shù)字和日期的類。命名空間-包含的類是標(biāo)準(zhǔn)的集合類,例如:哈希表,數(shù)組列表。命名空間-包含特殊的集合類,例如:連接列表和字符串集合。 命名空間-包括 files類。命名空間-包含編碼,解碼和操作字符串內(nèi)容的類。命名空間-包含的是匹配正則表達(dá)式和替代操作類。 命名空間-工作在萬維網(wǎng)方面包含的是瀏覽器請求和服務(wù)器響應(yīng)的類。
6、命名空間-包含頁面緩沖內(nèi)容和自定義緩沖操作的類。命名空間-包含執(zhí)行驗證和授權(quán),例如:窗體和密碼驗證的類。命名空間-包含執(zhí)行保存狀態(tài)的類。命名空間-包含構(gòu)建頁面的用戶接口的類。命名空間-包含HTML控件的類。命名空間-包含Web控件的類。.Net支持C#,C+和Visual Basic中的任一種語言作為你的編程語言來完成程序編寫。但不管你使用什么語言開發(fā)頁面,你需要明白在執(zhí)行前必須編譯,這就意味著執(zhí)行速度非???。第一次請求頁面,頁面被編譯成一個.NET類,這個類文件被保存在一個特殊的目錄下,這個目錄的名字叫Temporary Files。對于一個頁面一個通信類文件也會出現(xiàn)在Temporary F
7、iles目錄下。以后不管任何時候你請求那個同樣的頁面,那個通信類文件就會執(zhí)行。當(dāng)頁面被編譯的時候,它沒被直接地被編譯成機器碼而是被編譯成了一個中間語言,名字叫MSIL,所有.NET可用的語言都被編譯成這種中間語言。一個頁面不會被編譯成本地機器碼直到它被一個瀏覽器訪問,在那個時間點包含在Temporary Files目錄下的類文件用JIT編譯器編譯并且執(zhí)行。這些迷惑的方面體現(xiàn)在整個過程中且都在后臺運行,你必須要做的是用資源代碼為你的頁面創(chuàng)建一個文本文件。2.用Web服務(wù)器控件創(chuàng)建窗體用幾個基本W(wǎng)eb控件來代替標(biāo)準(zhǔn)的HTML窗體元素,例如radiobuttons、textboxes, and li
8、stboxes.在Web應(yīng)用程序中可以用這些控件創(chuàng)建用戶界面。 3.用驗證控件做頁面驗證傳統(tǒng)地,當(dāng)增加驗證到頁面中時,會面臨一個嚴(yán)峻的選擇。你可以添加窗體頁面驗證規(guī)則到你的服務(wù)器端代碼,也可以添加驗證規(guī)則到你的客戶端代碼。寫驗證代碼到客戶端代碼中的優(yōu)勢能夠及時反饋到你的用戶。例如,一個使用者忽略輸入一個要求檢驗的字段,你能夠及時的顯示一個錯誤信息而不需要返回到服務(wù)器端解決。人們喜歡客戶端的驗證。它能產(chǎn)生一種很好的效果。然而,問題是它不與所有的瀏覽器兼容。不是所有的瀏覽器支持JavaScript、不同版本的瀏覽器的不同版本支持JavaScript,所以客戶端驗證沒有保障。由于這個原因,許多開發(fā)者
9、決定添加自定義驗證到服務(wù)器端。因為服務(wù)器端代碼能夠和任何瀏覽器協(xié)同工作。這樣的做法是更有安全保障。同時這些驗證控件會自動地產(chǎn)生客戶端代碼和服務(wù)器端代碼。如果一個瀏覽器有能力支持JavaScript,客戶端的驗證腳本將會自動返回到瀏覽器。如果一個瀏覽器不支持JavaScript,那個驗證規(guī)則會自動在服務(wù)器端代碼中執(zhí)行??刂谱侄?RequiredFieldValidator控件你可以用這個控件來檢查在一個Web窗體中是否為空,典型地,你和TextBox控件一起使用這個控件。然而,這個控件也可以和其他的輸入型控件結(jié)合使用,例如:RadioButtonList控件。驗證表達(dá)式:RegularExpre
10、ssionValidator控件你能使用RegularExpressionValidator控件來驗證輸入的值是否和定義的正則表達(dá)式相匹配。例如:你能使用這控件來檢查一個用戶是否輸入一個合法的電子郵件地址,電話號碼,用戶名或密碼。比較值:CompareValidator控件這個CompareValidator 控件用于比較一個輸入的數(shù)據(jù)和另外一個值是否相同。另外一個值可能是固定值,例如:一個特定的數(shù)字或者是輸入到另一個控件中的一個值??偨Y(jié)錯誤:ValidationSummary控件假想一個頁面有50個字段假如你僅僅用上部分討論的那些驗證控件來顯示錯誤看見一個錯誤在頁面中將是很難的。例如:你可能
11、需要滾動到第48個頁面字段來找到這個錯誤信息。幸好,微軟除了包含上面提到的控件還包括ValidationSummary控件。你能用這個控件綜合所有的錯誤信息在一個頁面的上端或者你想要的任何一個地方。4.先進(jìn)的控件編程保存瀏覽狀態(tài)默認(rèn)地,幾乎所有的控件都會在先前的窗體中保留他們的屬性值。舉例來說,如果你輸入文本到一個Lebel標(biāo)簽上然后提交那個頁面,當(dāng)那個頁面再次被訪問時那個Lebel標(biāo)簽的內(nèi)容將會被保存下來。瀏覽狀態(tài)的妙處是它不依賴任何的特定服務(wù)器或瀏覽器的屬性。尤其,它不依賴cookies,session變量、或應(yīng)用程序變量。瀏覽狀態(tài)在一個名叫做VIEWSTATE的隱藏頁面中執(zhí)行,這個隱藏頁
12、面自動創(chuàng)建每個Web窗體。當(dāng)應(yīng)用時,瀏覽狀態(tài)能夠在你的網(wǎng)站中產(chǎn)生藝術(shù)性的積極效果,例如:你在一個支持瀏覽狀態(tài)的控件中顯示數(shù)據(jù)庫數(shù)據(jù),你不需要每次都返回到需要反饋到服務(wù)器的數(shù)據(jù)庫頁面。它能夠自動地保存頁面里的數(shù)據(jù)狀態(tài)。顯示和隱藏內(nèi)容假想把一個form變成很多頁面,以便一個人每次只看那個form的一個部分??梢栽O(shè)置單個控件和一組控件的Visible and Enabled屬性來隱藏和顯示頁面內(nèi)容。使用Visible and Enabled屬性每個控件,包括HTML和Web控件,有一個Visible 屬性來決定那個控件是否可見。 當(dāng)一個控件的Visible是false值,那個控件就不會在頁面上顯示;
13、那個控件也不會進(jìn)一步運行。Web控件(不是每個HTML控件)還有一個叫Enabled的屬性。當(dāng)Enabled的屬性是false值,你用的瀏覽器是或更高的版本那個控件被封住了,也不起作用了,當(dāng)用其他的瀏覽器的時候,如:網(wǎng)景瀏覽器那個控件不會被封,但它也是不起作用的。部署項目的魅力在于您在開發(fā)Web應(yīng)用程序時無需考慮打包和部署。當(dāng)需要其他類時可向App_Code目錄添加一個.cs文件即可開始編寫。當(dāng)希望將可本地化的字符串存儲在資源文件中時,可向App_GlobalResources目錄添加一個.resx文件并鍵入字符串。一切都順順當(dāng)當(dāng),根本就不必考慮編譯和部署方面的事情。在準(zhǔn)備進(jìn)行部署時,有多種可
14、選方案。最簡單的方案是將文件復(fù)制到主運行服務(wù)器并按要求編譯每一個文件(和在測試環(huán)境中一樣)。第二種方案是使用實用工具將應(yīng)用程序預(yù)編譯為二進(jìn)制版本,之后將只剩下要放到服務(wù)器上的一組程序集、靜態(tài)內(nèi)容和配置文件。第三種方案也使用,但要創(chuàng)建一個可更新的二進(jìn)制部署,其中.as*x文件保持不變(并且可修改),而所有代碼文件都編譯為二進(jìn)制程序集。6. C#語言C# 是一種簡潔、類型安全的面向?qū)ο蟮恼Z言,開發(fā)人員可以使用它來構(gòu)建在 .NET Framework 上運行的各種安全、可靠的應(yīng)用程序。使用 C#,您可以創(chuàng)建傳統(tǒng)的 Windows 客戶端應(yīng)用程序、XML Web services、分布式組件、客戶端
15、- 服務(wù)器應(yīng)用程序、數(shù)據(jù)庫應(yīng)用程序以及很多其他類型的程序。Microsoft Visual C# 2005 提供高級代碼編輯器、方便的用戶界面設(shè)計器、集成調(diào)試器和許多其他工具,以在 C# 語言版本 和 .NET Framework 的基礎(chǔ)上加快應(yīng)用程序的開發(fā)。C# 語法表現(xiàn)力強,只有不到 90 個關(guān)鍵字,而且簡單易學(xué)。C# 的大括號語法使任何熟悉 C、C+ 或 Java 的人都可以立即上手。了解上述任何一種語言的開發(fā)人員通常在很短的時間內(nèi)就可以開始使用 C# 高效地工作。C# 語法簡化了 C+ 的諸多復(fù)雜性,同時提供了很多強大的功能,例如可為空的值類型、枚舉、委托、匿名方法和直接內(nèi)存訪問,這些
16、都是 Java 所不具備的。C# 還支持泛型方法和類型,從而提供了更出色的類型安全和性能。C# 還提供了迭代器,允許集合類的實現(xiàn)者定義自定義的迭代行為,簡化了客戶端代碼對它的使用。作為一種面向?qū)ο蟮恼Z言,C# 支持封裝、繼承和多態(tài)性概念。所有的變量和方法,包括 Main 方法(應(yīng)用程序的入口點),都封裝在類定義中。類可能直接從一個父類繼承,但它可以實現(xiàn)任意數(shù)量的接口。重寫父類中的虛方法的各種方法要求 override 關(guān)鍵字作為一種避免意外重定義的方式。在 C# 中,結(jié)構(gòu)類似于一個輕量類;它是一種堆棧分配的類型,可以實現(xiàn)接口,但不支持繼承。除了這些基本的面向?qū)ο蟮脑?,C# 還通過幾種創(chuàng)新的語
17、言結(jié)構(gòu)加快了軟件組件的開發(fā),其中包括: 封裝的方法簽名(稱為委托),它實現(xiàn)了類型安全的事件通知。 屬性 (Property),充當(dāng)私有成員變量的訪問器。 屬性 (Attribute),提供關(guān)于運行時類型的聲明性元數(shù)據(jù)。 內(nèi)聯(lián) XML 文檔注釋。在 C# 中,如果需要與其他 Windows 軟件(如 COM 對象或本機 Win32 DLL)交互,可以通過一個稱為“Interop”的過程來實現(xiàn)?;ゲ僮魇?C# 程序能夠完成本機 C+ 應(yīng)用程序可以完成的幾乎任何任務(wù)。在直接內(nèi)存訪問必不可少的情況下,C# 甚至支持指針和“不安全”代碼的概念。C# 的生成過程比 C 和 C+ 簡單,比 Java 更為靈
18、活。沒有單獨的頭文件,也不要求按照特定順序聲明方法和類型。C# 源文件可以定義任意數(shù)量的類、結(jié)構(gòu)、接口和事件。C# 程序在 .NET Framework 上運行,它是 Windows 的一個必要組件,包括一個稱為公共語言運行時 (CLR) 的虛擬執(zhí)行系統(tǒng)和一組統(tǒng)一的類庫。CLR 是 Microsoft 的公共語言基礎(chǔ)結(jié)構(gòu) (CLI) 的一個商業(yè)實現(xiàn)。CLI 是一種國際標(biāo)準(zhǔn),是用于創(chuàng)建語言和庫在其中無縫協(xié)同工作的執(zhí)行和開發(fā)環(huán)境的基礎(chǔ)。用 C# 編寫的源代碼被編譯為一種符合 CLI 規(guī)范的中間語言 (IL)。IL 代碼與資源(如位圖和字符串)一起作為一種稱為程序集的可執(zhí)行文件存儲在磁盤上,通常具有
19、的擴展名為 .exe 或 .dll。程序集包含清單,它提供關(guān)于程序集的類型、版本、區(qū)域性和安全要求等信息。執(zhí)行 C# 程序時,程序集將加載到 CLR 中,這可能會根據(jù)清單中的信息執(zhí)行不同的操作。然后,如果符合安全要求,CLR 執(zhí)行實時 (JIT) 編譯以將 IL 代碼轉(zhuǎn)換為本機機器指令。CLR 還提供與自動垃圾回收、異常處理和資源管理有關(guān)的其他服務(wù)。由 CLR 執(zhí)行的代碼有時稱為“托管代碼”,它與編譯為面向特定系統(tǒng)的本機機器語言的“非托管代碼”相對應(yīng)。下圖演示了 C# 源代碼文件、基類庫、程序集和 CLR 的編譯時與運行時的關(guān)系。語言互操作性是 .NET Framework 的一個關(guān)鍵功能。因
20、為由 C# 編譯器生成的 IL 代碼符合公共類型規(guī)范 (CTS),因此從 C# 生成的 IL 代碼可以與從 Visual Basic、Visual C+、Visual J# 的 .NET 版本或者其他 20 多種符合 CTS 的語言中的任何一種生成的代碼進(jìn)行交互。單一程序集可能包含用不同 .NET 語言編寫的多個模塊,并且類型可以相互引用,就像它們是用同一種語言編寫的。除了運行時服務(wù),.NET Framework 還包含一個由 4000 多個類組成的內(nèi)容詳盡的庫,這些類被組織為命名空間,為從文件輸入和輸出到字符串操作、到 XML 分析、到 Windows 窗體控件的所有內(nèi)容提供多種有用的功能。
21、典型的 C# 應(yīng)用程序使用 .NET Framework 類庫廣泛地處理常見的“日?!比蝿?wù)。 OverviewWhen ASP was first released, Web programming was more difficult because you needed IIS to serve your ASP pages. Later, and Visual Studio 2005 made everything easier by introducing the Web site model of development. Instead of creating a new proj
22、ect inside Visual Studio, the Web site model lets you point to a directory and start writing pages and code. Furthermore, you can quickly test your site with the built-in Development Server, which hosts in a local process and obviates the need to install IIS to begin will introduce technology from d
23、ifferent aspects. .NET Framework Class Library is part of Microsofts overall .NET framework, which contains a vast set of programming classes designed to satisfy any conceivable programming Visual Basic, JScript, and C+. A great deal of the functionality of these programming languages example, for e
24、ach language, you would have to include methods for accessing the file system, working with databases, and manipulating s more, these languages contain similar programming constructs, can represent loops and conditionals. Even though the syntax of a conditional written in Visual Basic differs from t
25、he syntax of a conditional written in C+, the programming function is the same. Maintaining all this functionality for multiple languages requires a lot of work. Wouldnt it be easier to create all this functionality once and use it for every language?however, The .NET Framework Class Library does ex
26、actly that. It consists of a vast set of classes designed to satisfy any conceivable programming instance, 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
27、 performing tasks such as working with regular expressions and handling network protocols. furthermore, The .NET framework contains classes that represent all the basic variable data types such as strings, integers, bytes, characters, and arrays.The .NET framework is huge. It contains thousands of c
28、lasses (over 3,400). Fortunately, the classes are not simply jumbled together. The classes of the .NET framework are organized into a hierarchy of namespaces.A namespace is a logical grouping of classes. For example, all the classes that relate to working with the file system are gathered together i
29、nto the 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 time
30、s.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: refers to the namespace, and File refers to the particular class.The cla
31、sses contained in a select number of namespaces are available in your pages by default. (You must explicitly import other namespaces.) These default namespaces contain classes that you use most often in your applications: System Contains all the base data types and other useful classes such as those
32、 related to generating random numbers and working with dates and times. Contains classes for working with standard collection types such as hash tables, and array lists. Contains classes that represent specialized collections such as linked lists and string collections. Contains classes for working
33、with configuration files files). Contains classes for encoding, decoding, and manipulating the contents of strings. Contains classes for performing regular expression match and replace operations. Contains the basic classes for working with the World Wide Web, including classes for representing brow
34、ser requests and server responses. Contains classes used for caching the content of pages and classes for performing custom caching operations. Contains classes for implementing authentication and authorization such as Forms and Passport authentication. Contains classes for implementing session stat
35、e. Contains the basic classes used in building the user interface of pages. Contains the classes for the HTML controls. Contains the classes for the Web controls.You can choose C# or or C+ or Visual Basic to program page. regardless of the language that you use to develop your pages, you need to und
36、erstand that pages are compiled before they are executed. This means that pages can execute very quickly. The first time you request an 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 Files. For each and e
37、very page, a corresponding class file appears in the Temporary Files directory. Whenever you request the same page in the future, the corresponding class file is executed. When an page is compiled, it is not compiled directly into machine code. Instead, it is compiled into an intermediate-level lang
38、uage called Microsoft Intermediate Language (MSIL). All .NET-compatible languages are compiled into this intermediate language. An 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 Files directory is comp
39、iled 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 page. Forms with Web Server ControlsUseingseveral of the basic We
40、b 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. Form Validation with Validation ControlsTraditionally, Web developers have faced a tough choice when
41、adding form validation logic to their pages. You can add form validation routines to your server-side code, or you can add the validation routines to your client-side code. The advantage of writing validation logic in client-side code is that you can provide instant feedback to your users. For examp
42、le, 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 really like client-side validation. It looks great and creates a better overall user experience. The problem, however, is that it does not work with
43、all browsers. Not all browsers support JavaScript, and different versions of browsers support different versions of JavaScript, so client-side validation is never guaranteed to this reason, in the past, many developers decided to add all their form validation logic exclusively to server-side code. B
44、ecause server-side code functions correctly with any browser, this course of action was safer. At the same time, The Validation controls automatically generate both client-side and server-side code. If a browser is capable of supporting JavaScript, client-side validation scripts are automatically se
45、nt to the browser. If a browser is incapable of supporting JavaScript, the validation routines are automatically implemented in server-side code.Requiring Fields: The RequiredFieldValidator ControlYou use RequiredFieldValidator in a Web form to check whether a control has a value. Typically, you use
46、 this control with a TextBox control. However, nothing is wrong with using RequiredFieldValidator with other input controls such as RadioButtonList. Validating Expressions: The RegularExpressionValidator ControlYou can use RegularExpressionValidator to match the value entered into a form field to a
47、regular expression. You can use this control to check whether a user has entered, for example, a valid e-mail 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:
48、 The CompareValidator ControlThe CompareValidator control performs comparisons 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 ControlIm
49、agine 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 me
50、ssage.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. Control ProgrammingWorking with View StateBy default, almost all controls retain the values of their p
51、roperties between form posts. For example, if you assign text to a Label control and submit the form, when the page is rendered again, the contents of the Label control are preserved. The magic of view state is that it does not depend on any special server or browser properties. In particular, it do
52、es not depend on cookies, session variables, or application variables. View state is implemented with a hidden form field called VIEWSTATE that is automatically created in every Web Forms Page. When used wisely, view state can have a dramatic and positive effect on the performance of your Web site.
53、For example, if you display database data in a control that has view state enabled, you do not have to return to the database each time the page is posted back to the server. You can automatically preserve the data within the pages view state between form posts.Displaying and Hiding ContentImagine t
54、hat you want to break the tax form into multiple pages so that a person views only one part of the tax form at a can set the Visible and Enabled properties with individual controls and groups of controls to hide and display page content. Using the Visible and Enabled PropertiesEvery control, includi
55、ng both HTML and Web controls, has a Visible property that determines whether the control is rendered. When a controls Visible property has the value False, the control is not displayed on the page; the control is not processed for either pre-rendering or rendering.Web controls (but not every HTML c
56、ontrol) have an additional property named Enabled. When Enabled has the value False and you are using Internet Explorer version or higher, the control appears ghosted and no longer functions. When used with other browsers, such as Netscape Navigator, the control might not appear ghosted, but it does
57、 not function. Deployment ProjectsThe beauty of the is that you can develop your Web application without thinking about packaging and need another class ,you can Add a .cs file to the App_Code directory and start writing. When want to store localizable strings in a resource file, you can add a .resx
58、 file to the App_GlobalResources directory and type in the strings. Everything just works; you dont have to think about the compilation and deployment aspect at all. When you are ready to deploy, you have several options. The simplest choice is to copy your files to a live server and let everything be compi
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2025學(xué)年第12課從明朝建立到清軍人關(guān)-勤徑學(xué)升高中歷史必修上同步練測(統(tǒng)編版2019)
- 園林養(yǎng)護(hù)人員雇傭合同范文2025年
- 2025年伙伴合同終止協(xié)議
- 2025年企業(yè)辦公用品綜合供需合同
- 2025年官方物流配送協(xié)議書高清
- 2025年企業(yè)設(shè)備抵押擔(dān)保貸款合同
- 2025年動物收養(yǎng)協(xié)議版式
- 2025年糧食供需雙方合同策劃大綱
- 2025年智能交通項目提案報告模式
- 2025年企業(yè)維修保養(yǎng)年合作協(xié)議
- 助貸機構(gòu)業(yè)務(wù)流程規(guī)范
- DL∕T 5106-2017 跨越電力線路架線施工規(guī)程
- 西師大版數(shù)學(xué)四年級下冊全冊教學(xué)課件(2024年3月修訂)
- 骨科醫(yī)院感染控制操作流程
- 綠化養(yǎng)護(hù)服務(wù)投標(biāo)方案(技術(shù)標(biāo))
- 九年級物理第一課
- 食材配送技術(shù)方案
- 全年無休供貨承諾書
- 中藥的臨床合理應(yīng)用
- 材料設(shè)備采購進(jìn)度計劃控制措施
- 寧夏銀川三中2023-2024學(xué)年九年級上學(xué)期期末物理試卷
評論
0/150
提交評論