ASP.NET AutoPostBack 属性
ListControl 控件参考手册
定义和用法
AutoPostBack 属性用于设置或返回当用户在列表控件中选择一个项目时,是否发生自动回传到服务器的操作。
如果把该属性设置为 TRUE,则启用自动回传,否则为 FALSE。默认是 FALSE。
语法
<asp:SomeListControl AutoPostBack="TRUE|FALSE" runat="server"/>
实例
下面的实例把 RadioButtonList 控件的 AutoPostBack 属性设置为 "TRUE":
<script runat="server">
Sub Change(obj As Object, e As EventArgs)
Response.Write("You selected " & rb1.SelectedItem.Text)
End Sub
</script>
<form runat=server>
<asp:RadioButtonList id="rb1" AutoPostBack="True"
runat="server" OnSelectedIndexChanged="Change">
<asp:ListItem Text="Item 1" />
<asp:ListItem Text="Item 2" />
</asp:RadioButtonList>
</form>
Sub Change(obj As Object, e As EventArgs)
Response.Write("You selected " & rb1.SelectedItem.Text)
End Sub
</script>
<form runat=server>
<asp:RadioButtonList id="rb1" AutoPostBack="True"
runat="server" OnSelectedIndexChanged="Change">
<asp:ListItem Text="Item 1" />
<asp:ListItem Text="Item 2" />
</asp:RadioButtonList>
</form>
演示实例 »
ListControl 控件参考手册
点我分享笔记