i have below which i append to a dynamic created gridview. i retrieve the data using json. my problem is i have append an input button with onserverclick event to call server-side function to it but it doesn't work.. how do make the onserverclick event work i dynamically created the gridview and button..please help..tq so much...
<script type="text/javascript">
$(document).ready(function () {
Ret_LectureData();
});
function Ret_LectureData() {
var lectID = document.getElementById("<%=txtnopkj.ClientID%>").value;
//alert(lectID);
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "LData.ashx",
data: "{ 'lectID': '" + lectID + "' }",
dataType: "json",
success: function (result) {
$("#MainContent_gvLectureData").empty();
$("#MainContent_gvLectureData").append(
"<tr>"
+ "<th>NO.</th>"
+ "<th class='hiddencol'>sl_ss_id</th>"
+ "<th>SEMESTER</th>"
+ "<th>CODE</th>"
+ "<th>GROUP</th>"
+ "<th class='hiddencol'>sl_fr_id</th>"
+ "<th class='hiddencol'>sl_lect_id</th>"
+ "<th class='hiddencol'>sl_rep_id</th>"
+ "<th class='hiddencol'>sl_cou_bm</th>"
+ "<th>COURSE</th>"
+ "<th>STUDENT ENROLLED"
+ "<th>STUDENT EVALUATED</th>"
+ "<th class='hiddencol'>sl_total</th>"
+ "<th>SCORE (%)</th>"
+ "<th class='hiddencol'>sl_datecreate</th>"
+ "<th></th>"
+ "</tr>");
//alert(result[0].sl_id );
for (var i = 0; i < result.length; i++) {
j = i + 1;
$("#MainContent_gvLectureData").append(
"<tr><td>"
+ j + "</td><td class='hiddencol'class='hiddencol'>"
+ result[i].sl_ss_id + "</td><td>"
+ result[i].sl_term_id + "</td><td>"
+ result[i].sl_cou_id + "</td><td>"
+ result[i].sl_group_id + "</td><td class='hiddencol'>"
+ result[i].sl_fr_id + "</td><td class='hiddencol'>"
+ result[i].sl_lect_id + "</td><td class='hiddencol'>"
+ result[i].sl_rep_id + "</td><td class='hiddencol'>"
+ result[i].sl_cou_bm + "</td><td>"
+ result[i].sl_cou_bi + "</td><td>"
+ result[i].sl_enrolled + "</td><td>"
+ result[i].sl_evaluated + "</td><td class='hiddencol'>"
+ result[i].sl_total + "</td><td>"
+ result[i].sl_percentage + "</td><td class='hiddencol'>"
+ result[i].sl_datecreate + "</td>"
+ "<td></a><input id='btnComment' type='button' class='btnComment' value='Comment' onserverclick='Button1_ServerClick'/><img alt='' class='auto-style3' src='../Images/action_edit.png' onclick='' /></td>"
+ "</tr>");
}
},
error: function (result) {
alert("Error");
}
});
}
</script>