I have an ASP.NET page that uses a repeater to populate a grid. There will eventually be a dozen or so columns, one of which is a linkbutton that does a postback (it removes the row). The rest of the row I want to be clickable and navigate to the specified url I set up at runtime.
Here is the code for a row in the repeater:
<tr class='normal' onmouseover="this.className='highlight'" onmouseout="this.className='normal'"
onclick="location.href='<%#DataBinder.Eval(Container.DataItem, "url") %>';">
<td><%# DataBinder.Eval(Container.DataItem, "parcel")%></td>
<td><%# DataBinder.Eval(Container.DataItem, "address")%></td>
<td><%# DataBinder.Eval(Container.DataItem, "unitName")%></td>
<td><%# DataBinder.Eval(Container.DataItem, "countyName")%></td>
<td><asp:LinkButton CommandName="remove" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "parcel")%>' ID="LinkButton0" runat="server">Remove</asp:LinkButton></td>
</tr>
As you can see, I have the onclick directly navigate the user to the specified url, while the LinkButton event gets handled in the parent repeater's ItemCommand handler. If I click the linkbutton, both get fired, and all hell breaks loose. Is there any way to abstain the linkbutton or linkbutton cell from having the onclick event apply to it? The only assured way I can think of to do this is set up the onclick for each table cell, but that would be pretty ugly, especially since I'm using and in the repeater.