问题
This element
<asp:DropDownList ID="ItemDropDownList" runat="server" AutoPostBack="true" OnChange="setHidden()" .... >
Doesn't do postback when I use OnChange attribute. Even if I do it manually:
function setHidden() {
...
...
_doPostBack("","");
}
What's wrong?
回答1:
Use return statement instead of doing post back.
<asp:DropDownList ID="ItemDropDownList" runat="server" AutoPostBack="true"
OnChange="return setHidden()" .... >
function setHidden() {
...
....
return true; // you can return false to stop postback
}
来源:https://stackoverflow.com/questions/12989419/no-postback-after-javascript-function