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

[Solved] NestedViewTemplate and MasterTableView relation

2 Answers 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SD R34
Top achievements
Rank 1
SD R34 asked on 10 Aug 2009, 11:00 AM
Hello guys, i'm pretty new to ASP and telerik's controls.
I have a RagGrid control, that's contains table with data.
When pressing on entity expand's my nested view with 2 tabs, like in "Hierarchy with Templates" demo.
So, i need to establish relation between selected row in MasterTable and my tabs in nestedView.

...  
<MasterTableView DataSourceID="NewsDataSource" DataKeyNames="ID" ...> 
      <NestedViewTemplate> 
             <ParentTableRelation> 
                    <telerik:GridRelationFields DetailKeyField="Author_ID" MasterKeyField="Author_ID" /> 
             </ParentTableRelation> 
                    <asp:Panel runat="server" ID="InnerContainer" ...> 
                        <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0">  
                            <Tabs> 
                                <telerik:RadTab runat="server" Text="Author Information" PageViewID="PageView2">  
                                </telerik:RadTab> 
                           ...  
                            </Tabs> 
                        </telerik:RadTabStrip> 
                        <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">  
                           <telerik:RadPageView runat="server" ID="PageView2" Width="460px">  
                           <asp:DetailsView   
                                        ID="DetailsView1" AllowPaging="True" GridLines="None" Width="100%" 
                                        DataSourceID="NestedAuthorInfoDataSOurce" runat="server" DataKeyNames="ID">  
                                        <Fields> 
                         Some fields there  
                                        </Fields> 
                           </asp:DetailsView> 
                                    <asp:LinqDataSource ID="NestedAuthorInfoDataSOurce"   
                                        runat="server" ContextTypeName="NewsApp.NewsDataClassesDataContext"   
                                        TableName="authors">  
                                        Where="ID == @Author_ID">  
                                           <WhereParameters> 
                                                   <asp:Parameter Name="Author_ID"  Type="Int32" /> 
                                           </WhereParameters> 
                                    </asp:LinqDataSource> 
                          </telerik:RadPageView> 
                       </telerik:RadMultiPage>
        </NestedViewTemplate>
 MasterViewColumns, MasterviewDatasource, etc...
As i assume ParentTableRelation maps selected Author_ID field from MasterView to NastedView, so i can use Where as shown above.
But i got System.Web.Query.Dynamic.ParseException: Operator "==" incomplete with types "Int32" and "Object" (sound like this, i got this exception on my native language).
Author_ID in news table and ID in author table are both integer and not allows null.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Aug 2009, 12:43 PM
Hi,

As far I know you cannot directly add the ParentTableRelation inside the NestedViewTemplate. You can use the ParentTableRelation with normal Hierarchical Grid as shown in the following demo. The table relations are declaratively or programmatically set through the GridTableView.ParentTableRelation property. Each entry in this collection consists of a relation key names. These key names have to be also populated in each GridTableView DataKeyNames array. When these properties are specified correctly, Telerik RadGrid will be able to determine the child records of each GridTableView when the control builds the hierarchy, without handling the DetailTableDataBind event. Refer the following online demo for more details.
Declarative Relations

Regards
Shinu
0
SD R34
Top achievements
Rank 1
answered on 10 Aug 2009, 02:08 PM
Thanks for so rapid response, provided demo open my eyes on table relations in RadGrid :)
Tags
Grid
Asked by
SD R34
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
SD R34
Top achievements
Rank 1
Share this question
or