Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Jan 21, 2006 06:40 AM|LINK
set the DropDownList to have AutoPostBack="true"and have event handler for its SelectedIndexChanged event (e.g
<asp:DropDownList ID="ddl1" ...OnSelectedIndexChanged="DropDownListGrd_SelectedIndexChanged" />...)E.g same event handler method for all the DDLs in the GridView.
In the SelectedIndexChanged you can get to the current GridViewRow with a code such as this.
Protected Sub DropDownListGrd_SelectedIndexChanged(sender As Object,e As EventArgs)
Dim currentddl As DropDownList=DirectCast(sender,DropDownList)
Dim currGrdRow As GridViewRow = DirectCast(currentddl.NamingContainer, GridViewRow)
'Do something with the DDL and GridViewRow
E.g trick is just to be aware how control hierarchy goes within a
GridView. If you have reference to the DropDownList which raised the event, and you do, since that's standard in .Net Framework that sender argument provides this, you get the
GridViewRow it's located in via NamingContainer property.