dropdownlist SelectedIndexChanged not firing
-
hi all, anyone see an error in this? my selectindexchanged wont fire. Ive tried a lot of things, remving panel, keeping panel, taking other controls off the page etc. etc. The data loads perfectly. The control has "autopostback" set to false. If I do true, it tries to go to the server and I dont need it to go to the server, just ... fire the event. any help would be greatly appreciated, thanks in advance. aspx ----
codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; //DropDownList1.SelectedIndexChanged += new EventHandler (DropDownList1_SelectedIndexChanged); I tried with this and with defining this in aspx file DropDownList1.DataBind(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = "aah"; }
-
hi all, anyone see an error in this? my selectindexchanged wont fire. Ive tried a lot of things, remving panel, keeping panel, taking other controls off the page etc. etc. The data loads perfectly. The control has "autopostback" set to false. If I do true, it tries to go to the server and I dont need it to go to the server, just ... fire the event. any help would be greatly appreciated, thanks in advance. aspx ----
codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; //DropDownList1.SelectedIndexChanged += new EventHandler (DropDownList1_SelectedIndexChanged); I tried with this and with defining this in aspx file DropDownList1.DataBind(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = "aah"; }
Hi, If u want SelectIndexChanged method to run, u need to set AutoPostBack property of DropDownList to true. Then only it will fires. Try this, it will helps u... aspx ----
codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; DropDownList1.DataBind(); }//end-if } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedItem.ToString(); } Bye Pessi.
-
Hi, If u want SelectIndexChanged method to run, u need to set AutoPostBack property of DropDownList to true. Then only it will fires. Try this, it will helps u... aspx ----
codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; DropDownList1.DataBind(); }//end-if } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedItem.ToString(); } Bye Pessi.
-
Hi, If u want SelectIndexChanged method to run, u need to set AutoPostBack property of DropDownList to true. Then only it will fires. Try this, it will helps u... aspx ----
codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; DropDownList1.DataBind(); }//end-if } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedItem.ToString(); } Bye Pessi.
excellent. that worked, thanks man. M