Last post Jun 02, 2008 02:37 PM by anand_vijayan
Jun 01, 2008 03:49 PM|mmhbk|LINK
I want to create a new control, which is an extension of the DropDownList. - lets call it EDDL
EDDL includes a regular DropDownList and a TextBox.
The DropDownList takes values from a db table. It will also include a ListItem for "other".
When "other" is chosen, the TextBox will become visible and enabled for the user to fill in any text.
Whatever the user writes in the TextBox will be added to the db table (the source of the DropDownList).
What is the best way to implement this control. I've tried to do it with a UserControl that inherits from DropDownList, but got stuck.
Any help would be appreciated.
Jun 01, 2008 04:52 PM|emady|LINK
hi there ,
I think the best way is that you can create a custom user control you can not inherite from dropdownlist since you have an extra control which is textBox
Jun 02, 2008 02:37 PM|anand_vijayan|LINK
From what I understand it seems like a textbox should appear when the value 'Other' is chosen. This could be done by adding a selectedIndexChanged event to the drop down list and having the code to show/hide the textbox in the event handler call back. After
the data entered in the textbox is saved to the DB the values would have to read again from the DB and rebound to the drop down list.