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

radGrid inside RadPanelBarItem Template

3 Answers 137 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 24 Feb 2010, 11:28 PM

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?

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 02 Mar 2010, 11:52 AM
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.
0
Wai
Top achievements
Rank 1
answered on 18 Mar 2011, 06:26 PM
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 
0
Nikolay Rusev
Telerik team
answered on 24 Mar 2011, 09:18 AM
Hello Wai,

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


Greetings,
Nikolay
the Telerik team
Tags
PanelBar
Asked by
Andrew
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Wai
Top achievements
Rank 1
Share this question
or