Hello,
I have a 3-tier radgrid and I am using the DetailTableDataBind to set the SelectParameters of my ObjectDataSources. I am having trouble on the third tier accessing the information correctly. The data keys on the third tier contain all of the IDs I need for the datasource, but I could also get the keys from the first and second tier as they are the same. But I cannot seem to get the syntax correct to do this. My aspx and vb code are below.
ASPX:
<telerik:RadGrid ID="gvSites" DataSourceID="odsSiteList" runat="server" AutoGenerateColumns="False" GridLines="None"> <MasterTableView DataSourceID="odsSiteList" DataKeyNames="ID" Name="Sites" EditMode="EditForms"> <DetailTables> <telerik:GridTableView CssClass="detail_table" DataSourceID="odsCategoryList" AutoGenerateColumns="false" DataKeyNames="ID" Name="Categories" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add Category"> <DetailTables> <telerik:GridTableView CssClass="detail_table" DataSourceID="odsItemList" AutoGenerateColumns="false" DataKeyNames="Site_ID,Item_ID,Category_ID" Name="Items" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add Item">VB:
Private Sub gvSites_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs) Handles gvSites.DetailTableDataBind Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem) If "Categories".Equals(e.DetailTableView.Name) Then odsCategoryList.SelectParameters("SiteID").DefaultValue = dataItem.GetDataKeyValue("ID").ToString() End If If "Items".Equals(e.DetailTableView.Name) Then odsItemList.SelectParameters("CategoryID").DefaultValue = dataItem.GetDataKeyValue("ID").ToString() odsItemList.SelectParameters("SiteID").DefaultValue = ??? End IfEnd SubSo my issue here is getting the SiteID. It is the DataKey on the first-tier and it is also one of the DataKeys on the third-tier but I am not sure how to access it. I either need to get the SiteID from the current levels ("Items") DataKeys or get the parent of the parent.
Thank you,
Steve