!IsPostBack,TextMode,readonly和disabled,PostBackUrl(! Ispostback, textmode, readonly and disabled, postbackurl)

!IsPostBack(回调函数)IsPostBack 是指页面的状态是否是Post回发的状态,前面加逻辑非“!”符号,表示页面不是Post回发的状态下,也就是指页面初始的状态。

IsPostBack 是 asp.net 框架Page类中一个bool类型的属性,用来判断针对当前页面Form的请求是第一次还是非第一次请求:

1、当IsPostBack=true时表示非第一次请求,我们称为PostBack;

2、当IsPostBack=false时表示第一次请求。

TextModea、TextMode 属性用于设置或返回 TextBox 控件的行为模式。

b、语法:<asp:TextBox TextMode=”mode” runat=”server” />

c、TextBoxMode 枚举值之一。默认值为 SingleLine。

d、可能的值:SingleLine – 默认。表示单行输入模式。MultiLine – 表示多行输入模式。Password – 表示密码输入模式。

只读(Readonly)与禁用(Disable)的区别

标签的readonly和disabled属性的区别:

在表单元素中,readonly和disable有类似之处,因为它们都可以将一些表单元素设置为”不可用”状态,当然它们之间的区别是巨大的,下面就介绍一下这个两个属性有哪些区别,希望能够给需要的朋友带来一定的帮助。

两个属性不同点列举:

1.readonly属性只对表单元素的文本框、密码框和多行文本框有效,而disabled属性对所有的表单元素都会有效。

2.设置两个属性的外观不一样,这个自己可以观察一下。

3.设置readonly的表单元素value值依然会被提交,而设置disabled的表单元素值不会被提交。

PostBackUrl

PostBackUrl 属性用于获取或设置当 LinkButton 控件被点击时要回传的目标页面的 URL。

<asp:Button ID=”Button2″ runat=”server” Text=”取消” PostBackUrl=”~/Classinfo.aspx” CausesValidation=”false” />

————————

! Ispostback (callback function) ispostback refers to whether the state of the page is post postback, preceded by a logical non “!” symbol, indicating that the page is not post postback, that is, the initial state of the page.

Ispostback is a bool type attribute in the page class of the asp.net framework, which is used to determine whether the request for the form of the current page is the first or not:

1. When ispostback = true, it means that it is not the first request, which is called postback;

2. When ispostback = false, it indicates the first request.

The textmodea, textmode properties are used to set or return the behavior mode of the TextBox control.

b、语法:<asp:TextBox TextMode=”mode” runat=”server” />

c. One of the textboxmode enumeration values. The default value is singleline.

d. Possible values: singleline – default. Represents a single line input mode. Multiline – indicates multiline input mode. Password – indicates the password entry mode.

The difference between read only and disable

The difference between the readonly and disabled attributes of the tag:

In form elements, readonly and disable are similar because they can set some form elements to “unavailable” status. Of course, the differences between them are huge. Here are the differences between these two attributes, hoping to bring some help to friends in need.

The differences between the two attributes are listed:

1. The readonly attribute is only valid for the text box, password box and multi line text box of the form element, while the disabled attribute is valid for all form elements.

2. The appearance of the two properties is different. You can observe this for yourself.

3. The value value of the form element set to readonly will still be submitted, while the value of the form element set to disabled will not be submitted.

PostBackUrl

The postbackurl property is used to get or set the URL of the target page to be returned when the LinkButton control is clicked.

<asp:Button ID=”Button2″ runat=”server” Text=”取消” PostBackUrl=”~/Classinfo.aspx” CausesValidation=”false” />