c# - How to pass and retrieve table row data using QueryString in asp.net -
i have datatable
i have created
var a=[]; $("#datatable tbody").on( 'click', 'tr', function () { a=table.row( ).data(); });
now want pass array a[] web form using query string on button click
<asp:button id="button" onclick="click_function"/>
and then
[webmethod] click_function() { var darr = []; darr = table.row('.selected').data(); var url = "questiondetail.htm?questionid=" + darr; window.location.href = url; }
how should i?
and have retrieve array in new webform. so, data of row
i'm guessing
// javascript var table = $("#datatable").datatable();
if that's case add hidden field on form
<!-- html --> <input type="hidden" runat="server" id="hfselectedrow" />
and set data field
// javascript $("#datatable tbody").on( 'click', 'tr', function () { $('#hfselectedrow').val(table.row( ).data()); });
so on server can retreive data by
[webmethod] protected void button_click() { response.redirect("questiondetail.htm?questionid=" + hfselectedrow.value); }
Comments
Post a Comment