选择更改时如何启用 html select 回发 apsx 页面?
在asp.NET控件dropdownlist中,有一个属性AutoPostBack,如果设置为“True”,则整个页面将被回发。
如果aspx页面包含一个html元素“select”,例如:
<select id="list" name="list" runat="server"
DataTextField="Name" DataValueField="ID" ></select>
并且它的数据由代码隐藏填充。
问题是:如何让这个Select也具有AutoPostBack功能?
With asp.NET control dropdownlist, there is a property AutoPostBack, if it is set "True", the whole page will be posted back.
If the aspx page include a html element "select" like:
<select id="list" name="list" runat="server"
DataTextField="Name" DataValueField="ID" ></select>
and it data is filled by code-behind.
Question is: how to allow this Select have AutoPostBack function too?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

DropDownList 方法添加了 __doPostBack('selectelementname', 'commandname');调用 onchange 事件。当您更改该值时,将继续回发到服务器,然后 ASP.NET 控件在 LoadPostData 方法中处理回发数据。
HTH。
The DropDownList approach adds a __doPostBack('selectelementname', 'commandname'); call to the onchange event. When you change the value, this then proceeds to post back to the server, and then the ASP.NET control processes the postback data in LoadPostData method.
HTH.