zSynopsis zSynopsis - 1 year ago 175
ASP.NET (C#) Question

Selectable Table Row Jquery Asp.net

I would like to create a table where the rows are selectable via jquery.
I'd also like to pass certain table cell values from a double click event on a row to another page.

Does any one have examples of how this would work?

Answer Source
var selected = null;

   $("#<%=myTable.ClientID %>").find("tr").click(function(){
      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" */

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download