I have a combobox:
<ext:ComboBox ID="cbGroup" runat="server" Width="150"
OnItemSelected="cbGroup_ItemSelected">
</ext:ComboBox>
and a method:
protected void cbGroup_ItemSelected(object sender, EventArgs e)
{
FilterItemSelected(this, new EventArgs());
}
when the item in the combobox is changed the method isnt triggered.
what am i missing?
我认为您需要控件上的AutoPostBack="true"
。
基于我对ASP.NET DropDownList
控件的了解,我会说要在ComboBox
上查找AutoPostBack
属性并将其设置为true。
I don't know what component framework you're using, but the asp:DropDownList
has the OnSelectedIndexChanged
event which will be triggered when an item is selected, with the assumption that AutoPostBack
is set to true
:
<asp:DropDownList AutoPostBack="true" ID="cbGroup" runat="server" Width="150" OnSelectedIndexChanged="cbGroup_ItemSelected"></asp:DropDownList>
Update : As I mentioned in my comment to Philip Smith's answer, I think the problem is that you don't set AutoPostBack
to true
; without this setting, the control won't trigger the event on the server-side, since AutoPostBack
is standard set to false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.