Problem with adding an event to the combo

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?

Answers


I think you need AutoPostBack="true" on the control.


Based on what I know about the ASP.NET DropDownList control, I would say to look for an AutoPostBack property on the ComboBox and set it to 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


Need Your Help

Ruby gem (FFMPEG) "uninitialized constant"

ruby rubygems ffmpeg

When trying to use the FFMPEG gem on Mac OS X 10.6, ruby throws a NameError exception like so:

Special handling of quotes on Mac

macos textinput

When I type ' or " on my Mac (OS X 10.7.4) it underlines it and depending on next symbol treats the combination as a special character (for example ä for " + a).