Click to See Complete Forum and Search --> : Accessing values od dropdown in a usercontrol.


Amandeep
January 13th, 2003, 04:34 AM
I have made a usercontrol consisting of a dropdownlist which is poupulated with item from database.I used this usercontrol in a datagrid but was unable to access the value selected by the user from the usercontrol.How can i access the values ?

sager
January 17th, 2003, 04:54 PM
You have to create properties of the usercontrol that are passed back to the aspx page.

Try something like this in the usercontrol code

Public ReadOnly Property DropDownListValue() as string
Get
DropDownListValue = dropdownlist1.SelectedItem.Text
End Get
End Property


You would access this in your aspx page like this

strValue = Usercontrolname.DropDownListValue