I have created a RadGrid in the Page_init and have declared a GridTableView to incorporate the hierarchy.
My Hierarchy is expanded as a default. So the RadGrid1_DetailTableDataBind is called for every parent row about 1200 with a pagesize of 100. I only want to set the datasource when dealing with 3 of my parents.
When I do this, for the parent rows that I do not want to call the datasource, a Child View does come up with the Parents information in it. For the 3 rows I actually call, the correct information comes up. I do not want the Child View of the other parents to show. I am doing this this way for effeciency. I see my performance times greatly shrink if I only assign the datasource to the parents I want and not have the call to every parent. How can I stop from the child view showing up on the other parents?
RadGrid1.MasterTableView.HierarchyDefaultExpanded = True Dim tableSubCode As New GridTableView(RadGrid1) tableSubCode.Name = "SubCodes" tableSubCode.Width = Unit.Percentage(100) Dim relationFields1 As GridRelationFields = New GridRelationFields() relationFields1.MasterKeyField = "DetailID" relationFields1.DetailKeyField = "DetailID" tableSubCode.ParentTableRelation.Add(relationFields1) RadGrid1.MasterTableView.DetailTables.Add(tableSubCode) columnSubCodeCreation("SubCode", "Sub_Code", tableSubCode) columnSubCodeCreation("Household", "HouseHold_Count", tableSubCode) If mstrClientDataCategoryID1Description.Trim <> "" Then columnSubCodeCreation(mstrClientDataCategoryID1Description.Trim, "CD1", tableSubCode) End If If mstrClientDataCategoryID2Description.Trim <> "" Then columnSubCodeCreation(mstrClientDataCategoryID2Description.Trim, "CD2", tableSubCode) End If If mstrClientDataCategoryID3Description.Trim <> "" Then columnSubCodeCreation(mstrClientDataCategoryID3Description.Trim, "CD3", tableSubCode) End If If mstrReportDemographicID1Description.Trim <> "" Then columnSubCodeCreation(mstrReportDemographicID1Description.Trim, "Demographic1", tableSubCode) End If If mstrReportDemographicID2Description.Trim <> "" Then columnSubCodeCreation(mstrReportDemographicID2Description.Trim, "Demographic2", tableSubCode) End If If mstrReportDemographicID3Description.Trim <> "" Then columnSubCodeCreation(mstrReportDemographicID3Description.Trim, "Demographic3", tableSubCode) End If If mstrReportDemographicID4Description.Trim <> "" Then columnSubCodeCreation(mstrReportDemographicID4Description.Trim, "Demographic4", tableSubCode) End If If mstrReportDemographicID5Description.Trim <> "" Then columnSubCodeCreation(mstrReportDemographicID5Description.Trim, "Demographic5", tableSubCode) End If columnSubCodeCreation("Selected", "Selected", tableSubCode) If UcHeader.objSession.ApplicationId <> CInt(ConfigurationManager.AppSettings("MediaviewerAppID")) Then columnSubCodeCreation("Forced", "Forced", tableSubCode) End If columnSubCodeCreation("Circ", "Circ", tableSubCode) columnSubCodeCreation("Coverage", "Coverage", tableSubCode) If UcHeader.objSession.ApplicationId <> CInt(ConfigurationManager.AppSettings("MediaviewerAppID")) Then Dim dpCounter As Integer = 1 Dim dpCollection As IList(Of RadListBoxItem) = rlbDistributionPatterns.CheckedItems For Each item As RadListBoxItem In dpCollection columnSubCodeCreation(item.Text, "DP" & dpCounter.ToString, tableSubCode) dpCounter += 1 Next End If My Hierarchy is expanded as a default. So the RadGrid1_DetailTableDataBind is called for every parent row about 1200 with a pagesize of 100. I only want to set the datasource when dealing with 3 of my parents.
Private Sub RadGrid1_DetailTableDataBind(sender As Object, e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles RadGrid1.DetailTableDataBind Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem) Select Case e.DetailTableView.Name Case "SubCodes" Dim detailID As Integer = dataItem.GetDataKeyValue("DetailID").ToString() 'Dim Geography As String = dataItem.GetDataKeyValue("Geography").ToString() 'Dim CirculationTypeID As Integer = dataItem.GetDataKeyValue("CirculationTypeID").ToString() Dim Day As String = dataItem.GetDataKeyValue("Day").ToString() If mintCircSetID > 0 And (detailID = 29 Or detailID = 506 Or detailID = 509) Then e.DetailTableView.DataSource = GetDataTable(mstrSQL & ",1," & detailID & ",'" & Day & "'") End If End Select End SubWhen I do this, for the parent rows that I do not want to call the datasource, a Child View does come up with the Parents information in it. For the 3 rows I actually call, the correct information comes up. I do not want the Child View of the other parents to show. I am doing this this way for effeciency. I see my performance times greatly shrink if I only assign the datasource to the parents I want and not have the call to every parent. How can I stop from the child view showing up on the other parents?