select dropdownlist triggers click on row

G

Guest

I have a GridView which triggers the SelectedIndexChanging event when I click
on the row anywhere implemented by this code in RowDataBound event handler:
if ( e.Row.RowType == DataControlRowType.DataRow ){
e.Row.Attributes.Add( "onclick",this.GetPostBackClientEvent(
RegistrantsGridView, "Select$" + e.Row.RowIndex.ToString() ) );
}

The problem is that when I click on a DropDownList in the row, it triggers
the above the rows SelectedIndexChanging event.

Is there some way I can filter out the click on the DropDownList so it
doesn't trigger the row's event or maybe cancel the row's event?

Thanks.
 
G

Guest

Add the attribute on the cell level for each cell but the one that contains
the dropdownlist, e.g.
e.Row.Cells[0].Attributes.Add( "onclick",this.GetPostBackClientEvent(
RegistrantsGridView, "Select$" + e.Row.RowIndex.ToString() ) );
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top