I have a function which I defined in the code-behind as follows:
<WebMethod()> _
Public Shared Function testFunction() As Integer
Return 0
End Function
I'm trying to call it using Javascript on the client-side as shown below:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePartialRendering="True" EnablePageMethods="True" />
<div>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server" >
<script type="text/javascript">
function ShowEditForm(id, rowIndex) {
var grid = $find("<%= RadGrid1.ID %>");
PageMethods.
var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
grid.get_masterTableView().selectItem(rowControl, true);
window.radopen("EditFormVB.aspx?TS_ID=" + id, "UserListDialog");
return false;
}
function ShowViewForm(id, rowIndex) {
var grid = $find("<%= RadGrid1.ID %>");
var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
grid.get_masterTableView().selectItem(rowControl, true);
window.radopen("ViewForm.aspx?TS_ID=" + id, "UserListDialog");
return false;
}
function refreshGrid(arg) {
if (!arg) {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
}
else {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");
}
}
</script>
</telerik:RadCodeBlock>
Problem is when I call PageMethods I don't see my function in Intellisense and when I manually call my function PageMethods.testFunction()
and try to run the web app, I get an error that it doesn't exist. I have EnablePageMethods set to "True", I'm not sure what I'm missing.