2. Advanced Control Programming
Working with View State
By default, almost all ASP.NET controls retain the values of their properties 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 does 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. 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 page's view state between form posts.
Displaying and Hiding Content
Imagine that you are creating a form with an optional section. For example, imagine that you are creating an online tax form, and you want to display or hide a section that contains questions that apply only to married tax filers.
Or, imagine that you want to add an additional help button to the tax form. You might want to hide or display detailed instructions for completing form questions depending on a user's preferences.
Finally, imagine that you want to break the tax form into multiple pages so that a person views only one part of the tax form at a time.
In the following sections, you learn about the properties that you can use to hide and display controls in a form. You learn how to use the Visible and Enabled properties with inpidual controls and groups of controls to hide and display page content.
Disabling View State
In certain circumstances, you might want to disable view state for an inpidual control or for an ASP.NET page as a whole. For example, you might have a control that contains a lot of data (imagine a RadioButtonList control with 1,000 options). You might not want to load the data into the hidden __VIEWSTATE form field if you are worried that the form data would significantly slow down the rendering of the page.
B.原文的翻译ASP.NET 技术1.构建 ASP.NET 页面ASP.NET 和ASP.NET结构
ASP.NET是微软.NET framework整体的一部分, 它包含一组大量的编程用的类,满足各种编程需要。
.NET类库
举例来说,对于每一种语言,必须包括存取文件系统、与数据库协同工作和操作字符串的方法。论文网
此外,这些语言包含相似的编程构造。每种语言,举例来说,都能够使用循环语句和条件语句。即使用Visual Basic写的条件语句的语法不与用C++写的不一样,程序的功能也是相同的。
最后,大多数的编程语言有相似的数据变量类型。对大多数的语言,你有设定字符串类型和整型数据类型的方法。
.NET类库不完全是那样。 它含有大量的满足编程需要的类。举例来说,.NET类库包含处理数据库访问的类和文件协同工作,操作文本和生成图像。 除此之外,它包含更多特殊的类用在正则表达式和处理Web协议。
.NET framework,此外包含支持所有的基本变量数据类型的类,比如:字符串、整型、字节型、字符型和数组。
- 上一篇:Java与网络英文文献和中文翻译
- 下一篇:中国餐饮业分析英文文献和中文翻译
-
-
-
-
-
-
-
现代简约美式风格在室内家装中的运用
浅析中国古代宗法制度
g-C3N4光催化剂的制备和光催化性能研究
C++最短路径算法研究和程序设计
中国传统元素在游戏角色...
江苏省某高中学生体质现状的调查研究
上市公司股权结构对经营绩效的影响研究
NFC协议物理层的软件实现+文献综述
高警觉工作人群的元情绪...
巴金《激流三部曲》高觉新的悲剧命运