Access to all parent tables "DataKeyNames" in 4 level hierarchical RadGrid and _DetailTableDataBind event

0 Answers 35 Views
Grid
Mohamad Javad
Top achievements
Rank 1
Mohamad Javad asked on 30 Jan 2022, 09:49 AM | edited on 30 Jan 2022, 05:45 PM

hi

I have 4 table hierarchies in Radgrid.

to fill out  "SqlDataSource_Third"
Table "Third_Table"
Need to access "DataKeyNames" All Parent tables including access to:

"Master_ID" from "Mater_Table" table
"First_ID" from table "First_Table"
"Second_ID" from the "Second_Table" table

I Need "DataKeyNames" All Parent tables In the event:

"RadGrid1_DetailTableDataBind"
Do I have access?

 

 


        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource_Master" AutoGenerateColumns="False" OnDetailTableDataBind="RadGrid1_DetailTableDataBind">
            <MasterTableView DataSourceID="SqlDataSource_Master" Name="Master_Table" DataKeyNames="Master_ID">
                <DetailTables>
                    <telerik:GridTableView runat="server" Name="First_Table" DataKeyNames="First_ID" DataSourceID="SqlDataSource_First">
                        <DetailTables>
                            <telerik:GridTableView runat="server" Name="Second_Table" DataKeyNames="Second_ID" DataSourceID="SqlDataSource_Second">
                                <DetailTables>
                                    <telerik:GridTableView runat="server" Name="Third_Table" DataKeyNames="Third_ID" DataSourceID="SqlDataSource_Third">
                                        <Columns>
                                            <telerik:GridBoundColumn UniqueName="column_Third">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </telerik:GridTableView>
                                </DetailTables>
                                <Columns>
                                    <telerik:GridBoundColumn UniqueName="column_Second">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <Columns>
                            <telerik:GridBoundColumn UniqueName="column_First">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridBoundColumn UniqueName="column_Master">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>



        <asp:SqlDataSource ID="SqlDataSource_Third" runat="server">
            <SelectParameters>
                <asp:Parameter Name="Master_ID" Type="Int32" />
                <asp:Parameter Name="First_ID" Type="Int32" />
                <asp:Parameter Name="Second_ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>


 


        protected void RadGrid1_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            if (e.DetailTableView.Name == "Third_Table")
            {
                GridTableView detailtabl1 = (GridTableView)e.DetailTableView;
                GridDataItem Third_parentItem = (GridDataItem)detailtabl1.ParentItem;


                SqlDataSource_Third.SelectParameters["Second_ID"].DefaultValue = Third_parentItem.GetDataKeyValue("Second_ID").ToString();

                SqlDataSource_Third.SelectParameters["Master_ID"].DefaultValue = ?

                SqlDataSource_Third.SelectParameters["First_ID"].DefaultValue = ?


            }
        }

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Mohamad Javad
Top achievements
Rank 1
Share this question
or