tags:

views:

129

answers:

1

I have the following dropdownlist control.

<asp:dropdownlist ID="ddlFeeds" AutoPostBack="true" OnSelectedIndexChanged="ddlFeeds_OnSelectedIndexChanged" runat="server"></asp:dropdownlist>

How do i unbind ddlFeeds_OnSelectedIndexChanged from ddlFeeds?

+2  A: 

After the page has initialized, set the ddlFeeds.SelectedIndexChanged += null. You will need to do this on every load, irregardless of postback.

A better plan would be to just eliminate the OnSelectedIndexChanged attribute from the ASPX template.

Wyatt Barnett
I did ddlFeeds.SelectedIndexChanged = null; and I get a compilation error with the msg: 'CS0079: The event 'System.Web.UI.WebControls.ListControl.SelectedIndexChanged' can only appear on the left hand side of += or -='
burnt1ce
you have to do ddl.SelectedIndexChanged += null;
iHeartDucks