This is a migrated thread and some comments may be shown as answers.

$find("<%= gridResults.ClientID %>").get_masterTableView() is coming back null

1 Answer 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Boone
Top achievements
Rank 2
Boone asked on 10 Aug 2010, 10:24 PM
I am trying to follow http://www.telerik.com/help/aspnet-ajax/grid-live-data-from-web-service.html and do something similar. Although when I try to access the MasterTableView it comes back as null. What am I missing???

<head runat="server">
    <title></title>
     <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
       <script type="text/javascript">
            //<![CDATA[
           function pageLoad(sender, args) {
               SearchServices.GetSearches(updateGrid);
           }
           function updateGrid(result) {
               //alert(result[0].OriginCity);
               var tableView = $find("<%= gridResults.ClientID %>").get_masterTableView();
               tableView.set_dataSource(result);
               tableView.dataBind();
           }
           //]]>
       </script>
   </telerik:RadCodeBlock>
</head>
<body>
    <form runat="server">
        <telerik:RadScriptManager ID="RadScriptManager" runat="server" EnablePageMethods="true">
            <Services>
                <asp:ServiceReference  Path="SearchServices.svc" />
            </Services>
        </telerik:RadScriptManager>
         
        <telerik:RadGrid ID="gridResults" runat="server">
            <MasterTableView
                Name="Main"
                AutoGenerateColumns="false"
                Width="100%">
                <Columns>
                    <telerik:GridBoundColumn HeaderText="ID" DataField="ID" />
                    <telerik:GridBoundColumn HeaderText="City" DataField="OriginCity" />
                    <telerik:GridBoundColumn HeaderText="State" DataField="OriginState" />
                </Columns>
            </MasterTableView>
    </telerik:RadGrid>
    </form>

1 Answer, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 11 Aug 2010, 07:11 AM
Hi Boone,

When binding the Grid manually on the client you need to attach a handler to its OnCommand client event. This is explained in this help article. To solve the problem you need to simply add the following:
<telerik:RadGrid ID="gridResults" runat="server">
    <MasterTableView>
        ...
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnCommand="function(){}"/>
    </ClientSettings>
</telerik:RadGrid>

Sincerely yours,
Pavel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Boone
Top achievements
Rank 2
Answers by
Pavel
Telerik team
Share this question
or