Hello Friends,
Can anyone tell me, how I can get the value of hidden field using javascript.
Here is aspx code
<asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete" CssClass="delbutton" CommandArgument='<%#Eval("noticeid") %>'>Delete
<asp:HiddenField ID="hfID" Value='<%#Eval("noticeid") %>' runat="server" />
Here what I'm trying, I'm binding value to hidden field. Using this value I'm going to delete record using Json.
I tried following JavaScript
function funDelete() {
alert("Start");
if (confirm("Do you want to delete this record?")) {
alert("Step 1");
try {
$(document).ready(function() {
$('#lnkDelete').click(function() {
alert("Ready");
});
});
var id = document.getElementById('<% =hfID.ClientID %>').value;
alert("ID:" + id);
$.ajax({
type: "POST",
url: "QCNotice.aspx/deleteComment",
data: "{'args':'" + id + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function() {
alert("IN");
row.css("background-color", "Red");
row.fadeOut(500, function() {
row.remove();
});
},
error: function(event, request, settings) {
alert("Ajax Error");
}
});
}
catch (e) {
alert("Error:" + e.message);
}
}
return false;
}
It gives error saying:
Overload resolution failed because no accessible 'Write' can be called with these arguments
Any idea, where I'm going wrong??
Thanks in advance