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与网络英文文献和中文翻译
下一篇:中国餐饮业分析英文文献和中文翻译

AngularJS技术介绍英文文献和中文翻译

开关电源水冷却系统英文文献和中文翻译

减数分裂和基因重组英文文献和中文翻译

太阳能最大功率点追踪和...

移动码头的泊位分配问题英文文献和中文翻译

虚拟船舶装配集成建模方...

中学生科学探究中对等论...

浅谈高校行政管理人员的...

STC89C52单片机NRF24L01的无线病房呼叫系统设计

提高教育质量,构建大學生...

浅论职工思想政治工作茬...

压疮高危人群的标准化中...

上海居民的社会参与研究

酵母菌发酵生产天然香料...

AES算法GPU协处理下分组加...

从政策角度谈黑龙江對俄...

基于Joomla平台的计算机学院网站设计与开发