Question

and thanks for reading my post.

I think.. this might be pretty easy for a experienced asp.net developer which have tweaked much with listviews and such.

The thing is.. I have this LinkButton which ofcourse.. have the commandname and commandargument and that works like a charm!

The issue is.. that the customer wants the WHOLE row to be clickable.. not just the linkbutton in the first .

So.. therefore.. i'm trying to force a itemcommand on a table row (tr)

here is the code :

<asp:ListView runat="server" ID="lvProdukter" DataKeyNames="ProduktSXX" OnItemCommand="lvProdukter_ItemCommand" ItemType="ProductXXXX">

<ItemTemplate>

<tr>

<td>

<asp:LinkButton runat="server" ID="lnkSelectProdukt" CssClass="lvitemlink" CommandArgument='<%# Item.ProduktS + ";" + Item.VaregrId %>'
CommandName="SelectProdukt">
<%# Item.TheName ?? "&nbsp;" %>
</asp:LinkButton>

</td>

<td>

bla-bla-bla..

</td>

etc.etc....

Was it helpful?

Solution

Well I haven't tried it but I think there are two ways of doing this.

  1. Make the tr runat='server' and on click use _dopostback function. and see it works or not.

  2. Use jQuery tr click and call link button click inside it.

    $("#lvProdukter tr").click(function() { //call the link button click here. });

OTHER TIPS

use Jquery on the client side:

$('#table-name').on('click', 'tr', function()
{
    alert('Hello');

});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top