radGrid inside RadPanelBarItem Template

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    4 posts
    Member since:
    Jun 2009

    Posted 24 Feb 2010 Link to this post

    I am trying to setup a datagrid inside a RadPanelItem template.
    my setup is as follows (code is abreviated up to the grid)

    <telerik:RadPanelBar> 
    <Items> 
    <telerik:RadPanelItem> 
    <Items> 
    <telerik:RadPanelItem> 
    <ItemTemplate> 
    <telerik:RadGrid ID="rgrdNBDetail" runat="server" GridLines="None" AutoGenerateColumns="false" PageSize="10">  
    <ClientSettings> 
      <Scrolling AllowScroll="false" /> 
      <ClientEvents OnRowClick="rGrid_RowClick"/>  
    </ClientSettings> 
    <MasterTableView ClientDataKeyNames="ID">  
    <Columns> 
    <telerik:GridBoundColumn DataField="ID" Visible="false"</telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="SPCX" Visible="false">
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="SPCY" Visible="false">  
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn HeaderText="Name" DataField="SiteName"/>  
    <telerik:GridBoundColumn HeaderText="Distance" DataField="Distance"/>  
    </Columns> 
    </MasterTableView> 
    <PagerStyle AlwaysVisible="false" /> 
    </telerik:RadGrid> 
    </ItemTemplate> 
    </telerik:RadPanelItem> 
    </Items> 
    </telerik:RadPanelItem> 
    ... 

    Notice I am not declaring a datasource as I will be binding this grid through a webservice on the client side.  After the webservice is called and I attempt to databind the grid, var tableView = datagrid.get_masterTableView();  it is not returning a tableView (value is null).
    ...   
    var item = panelbar.findItemByValue('NBDetail');  
    var datagrid = item.findControl('rgrdNBDetail');  
    var tableView = datagrid.get_masterTableView();  
    tableView.set_dataSource(data);  
    tableView.dataBind();  
    tableView.set_virtualItemCount(data.count);  
    ... 

    What do I need to do to enable clientside databinding on the grid object inside the radPanelItem template?  It's appears that the TableView is not being created server side when it is located inside the template so I can not get a reference to it. (I moved the grid outside the panel and it works fine)  Is this the correct way to go about accomplishing this task?

  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 02 Mar 2010 Link to this post

    Hello Andrew,

    You must hook client OnCommand event. This will inform RadGrid that client-binding might be performed without explicit binding on server.

    Sincerely yours,
    Nikolay
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Wai
    Wai avatar
    7 posts
    Member since:
    Jun 2008

    Posted 18 Mar 2011 Link to this post

    Hello,

    I have a similar problem.  The get_masterTableView returns null while the gird is inside a panel bar.  Would someone be more specified on the OnCommand event?

    Thanks,

    Wai 
  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 24 Mar 2011 Link to this post

    Hello Wai,

    You can attach even empty function to RadGrid client OnCommand. For example:
    <ClientSettings>
            <ClientEvents OnCommand="function(){}" />
    </ClientSettings>


    Greetings,
    Nikolay
    the Telerik team
Back to Top