94
rated 0 times
[
100]
[
6]
/ answers: 1 / hits: 36919
/ 11 Years ago, wed, april 10, 2013, 12:00:00
I want to call Ajax in javascript but it gives CallPageMethod undefined error. How to define it? and I'm newbie in Ajax. Can you help me?
<script type=text/javascript>
function ValidateDelete() {
var result = CallPageMethod(IsLangExists, success, fail);
if (result == true) {
return confirm('Do you want to continue ?')
}
else alert('You can not delete this record');
}
function success(response) {
//alert(response.d);
}
function fail(response) {
//alert(An error occurred.);
}
</script>
<asp:GridView ID=grdList OnRowCommand=grdList_RowCommand>
<Columns>
<asp:BoundField DataField=LangId HeaderText=LangId Visible=false />
<asp:TemplateField HeaderText=Delete>
<ItemTemplate>
<asp:ImageButton ID=imgBtnDelete runat=server CommandName=_Delete CommandArgument='<%#Eval(LangId)%>' ImageUrl=~/Image/delete_icon.gif OnClientClick=return ValidateDelete();
ToolTip=Delete />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
code behind
[WebMethod]
public static bool IsLangExists()
{
return true;
}
More From » jquery