Selectable Jquery Asp.net Row Table

I would like to create a table in which rows can be selected through jquery. I would also like to pass certain values ​​of a table cell from a double-click event in a row to another page.

Does anyone have any examples of how this will work?

+3
source share
1 answer
var selected = null;

$(document).ready(function(){
   $("#<%=myTable.ClientID %>").find("tr").click(function(){
      $(selected).removeClass("selected");
      $(this).addClass("selected");
      selected = this;
   });

   $("#<%=myTable.ClientID %>").find("tr").dblclick(function(){

      /* if you just want to dig into that record I would put a custom attribute on the row */
      window.location = "<%=ResolveUrl("~/one/folder/deeper/") %>?record=" + $(this).attr("RecordId");

      /* or you could have a hidden LinkButton in the row (Text="" or not set) that you could trigger. Make sure you set the CommandName="Something" and CommandArgument="RecordId" */
      $(this).find("a").click();
   });

});
+2
source

Source: https://habr.com/ru/post/1704866/


All Articles