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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top