Combo box Event catching
-
Hi, I have a ascx page ItemEdit.ascx. It contains a combobox. This control dynamically added to a aspx page. Now the problem is that i am unable to catch the event(selectedindexchange)of combobox in ItemEdit.ascx control. How will i overcome this problem. plz help me this is very urgent. Thanks n Regards, Alok....
-
Hi, I have a ascx page ItemEdit.ascx. It contains a combobox. This control dynamically added to a aspx page. Now the problem is that i am unable to catch the event(selectedindexchange)of combobox in ItemEdit.ascx control. How will i overcome this problem. plz help me this is very urgent. Thanks n Regards, Alok....
If you want to catch the event inside the user control itself, that will not be a problem. For that you can double click on the combobox while in design mode and enviorment will auto generate the handler for the SelectedIndexChanged event by default in side the code behind for .ascx file. But don't forget to set the "AutoPostBack" property of the dropdownbox to true. If you want to handle SelectedIndexChanted even inside your page where you are using this user control then the quickest souloution is as follows: Create a public property in your user control like: public DropDownList List { return ddlYourTargetComboBox; } on your page do something like: ucYourUserControlInstance.List.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged); void list_SelectedIndexChanged(object sender, EventArgs e) { //Implement logic here } Hope this helps
-
Hi, I have a ascx page ItemEdit.ascx. It contains a combobox. This control dynamically added to a aspx page. Now the problem is that i am unable to catch the event(selectedindexchange)of combobox in ItemEdit.ascx control. How will i overcome this problem. plz help me this is very urgent. Thanks n Regards, Alok....
And also add AutoPostBack Property = true along with the above code.
Regards, Arun Kumar.A