当用户点击View链接时,我想将jQuery代码中的studentID传递给C#代码函数,请指教。将jQuery网格值传递给c#
$(document).on("ready", function() {
obj = {
width: 940,
height: 555,
title: "Students List ",
};
obj.colModel = [
{
dataIndx: 7, editable: false, sortable: false, title: "Password", width: 65, align: "center", resizable: false, dataIndx: "studentID",
render: function (ui)
{
var rowData = ui.rowData, dataIndx = ui.dataIndx;
var val = rowData[dataIndx];
return "<a href='#" + rowData.studentID + "' style='text-decoration: underline;'>View</a>";
}, className: "checkboxColumn"
},
{ title: "Student Name", width: 220, getEditCellData: saveCell, dataIndx: "studentName" },
{ title: "Student ID", width: 120, getEditCellData: saveCell, dataIndx: "studentID" },
];
obj.dataModel = {
dataType: "JSON",
rPP: 20,
sortDir: "down",
rPPOptions: [1, 10, 20, 30, 40, 50, 100, 500, 1000],
filterIndx: "",
filterValue: ""
};
});
</script>
电网
<asp:Content ID="Content2" ContentPlaceHolderID="PageTitlePlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
<div id="grid_table" style="margin: auto;"></div>
</asp:Content>
我可能会做错事。我试过这样的代码(返回“”;)。之后,我用警报的jQuery代码,但没有发生任何事情。请指教。 – Paul
哦,我的坏让我编辑我的答案 – Gjohn
对不起,如果我做错了什么,但请看下面的代码,没有运气:$(document).ready(function(){(“。viewStudent”)。 (“click”,function(){alert(“Record Selected ...”); }); }); – Paul