I need to pass a GridView DataKey (Primary key) as parameter in an ajax call JSON with jquery.
However,i dont't to expose my primary key column in source code HTML.I've already tried to hide the TD (first column) of the table,but it doenst hide in source code.
Here is the Jquery code:
$(function(){
$("tr").each(function(){//hide primary key columns in design
$("td:first",this).hide();
$("th:first",this).hide();
});
$("tr:not(:first)").click(function(){
$.ajax({
type:"POST",
url:"CRUDWeb.asmx/DeleteRow",
data:"{'duviID': '" + $(this).children("td:first").html() + "'}",//get primary key
contentType:"application/json; charset=utf-8",
dataType:"json",
success:function(){},
error:function(rh){alert(rh.responseText);}
});
});
});
Any ideas?