Reputation: 3976
I have DropDownList and a button in ListView for each row. Now i want to get the selected value of the dropdownlist on Button click event. How can i get this.
Please guide me.
Thanks.
Upvotes: 0
Views: 2650
Reputation: 4183
Set the CommandName
property of your buttons, handle the ItemCommand
event of your listview, and use FindControl
to find the DropDownList.
For reference, see
Upvotes: 2
Reputation: 1902
EDIT: on second thoughts, use answer of TC..
in the button click event do something like:
Button b = (Button)sender;
DropDownList ddl = (DropDownList)b.Parent.FindControl("DropDownList ID");
string DropDownListSelectedValue = ddl.SelectedValue;
Upvotes: 0