Hi,
I was working on a small sample that will populate a RadGrid using client side code and when I tried using 'get_masterTableView' function the script threw the following error:
"Object doesn't support property or method 'get_masterTableView'"
Here's my code:
and here's my Web Method in the code behind:
Please, help.
Many thanks in advance.
I was working on a small sample that will populate a RadGrid using client side code and when I tried using 'get_masterTableView' function the script threw the following error:
"Object doesn't support property or method 'get_masterTableView'"
Here's my code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestWebMethodCall.aspx.cs" Inherits="RestfulServiceClientApp.TestWebMethodCall" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
src
=
"Scripts/jquery-1.11.1.min.js"
></
script
>
<
script
type
=
"text/javascript"
>
//
<![CDATA[
$(document).ready(function () {
alert('DOM Ready !');
$('<%=RadAjaxLoadingPanel1.ClientID%>').show('<%=grd_ajaxifiedGrid.ClientID %>');
PageMethods.GetData(successMethod);
function successMethod(result) {
alert(result);
var masterTableView = $('<%=grd_ajaxifiedGrid.ClientID %>').get_masterTableView();
masterTableView.set_datasource(result);
masterTableView.dataBind();
$('<%=RadAjaxLoadingPanel1.ClientID%>').hide('<%=grd_ajaxifiedGrid.ClientID %>');
}
});
//]]>
</
script
>
</
telerik:RadCodeBlock
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"scrptmgr_radScriptManager"
EnablePageMethods
=
"true"
></
telerik:RadScriptManager
>
<
telerik:RadGrid
ID
=
"grd_ajaxifiedGrid"
runat
=
"server"
EnableViewState
=
"false"
CellSpacing
=
"-1"
GridLines
=
"Both"
ClientIDMode
=
"Static"
Width
=
"200"
Height
=
"400"
></
telerik:RadGrid
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Skin
=
"Default"
></
telerik:RadAjaxLoadingPanel
>
<
div
>
</
div
>
</
form
>
</
body
>
</
html
>
and here's my Web Method in the code behind:
[WebMethod]
public
static
List<
string
> GetData()
{
List<
string
> myLst =
new
List<
string
>();
myLst.Add(
"Test1"
);
myLst.Add(
"Test2"
);
myLst.Add(
"Test3"
);
myLst.Add(
"Test4"
);
myLst.Add(
"Test5"
);
return
myLst;
}
Please, help.
Many thanks in advance.