I have the following dropdown control:
<asp:DropDownList ID="ExecutiveID" runat="server" AutoPostBack="True">
I would like to set the OnSelectedIndexChanged if a querystring is present. Here is my code:
protected void Page_Load(object sender, EventArgs e)
{
ObjectDataSource1.SelectParameters.Clear();
if (Request.QueryString["ExecutiveID"] != "" && Request.QueryString["ExecutiveID"] != null)
{
ObjectDataSource1.SelectParameters.Add(new QueryStringParameter("ExecutiveID", TypeCode.Int32, "ExecutiveID"));
ExecutiveID.OnSelectedIndexChanged = "ExecutiveID_SelectedIndexChanged";
}
}
protected void ExecutiveID_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect("executives.aspx?executiveid=" + ExecutiveID.SelectedValue);
}
It seems as though however I cannot the OnSelectedIndexChanged. I receive the following error when trying to build:
Error 1 'System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(System.EventArgs)' is inaccessible due to its protection level
Any help on this would be most appreciated.
Thanks