I have a radgrid on my page that I create in the Page_Init. It has the MasterTableView along with a hierarchy setup call 'SubCodes'.
In my RadGrid1_ItemDataBound I am customizing the PageSizeComboBox for both the MasterTableView and SubCodes.
The boxes for my MasterTableView and the DetailsTables come up with the correct entries. When I change the entry in one of my SubCodes DetailTables the system does not recall my RadGrid1_NeedDataSource and refresh the screen. It does if I change the entry in the MasterTableView. I believe it has something to do with assigning the ownerTableViewId to e.Item.ClientID for the SubCodes. What should I be doing. Below is the Page_Init function on how I create the radGrid.
In my RadGrid1_ItemDataBound I am customizing the PageSizeComboBox for both the MasterTableView and SubCodes.
Public Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound If (TypeOf (e.Item) Is GridPagerItem) And e.Item.OwnerTableView.Name <> "SubCodes" Then Dim dropDown = DirectCast(e.Item.FindControl("PageSizeComboBox"), RadComboBox) dropDown.Items.Clear() dropDown.Items.Add(New RadComboBoxItem("10")) dropDown.FindItemByText("10").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID) dropDown.Items.Add(New RadComboBoxItem("20")) dropDown.FindItemByText("20").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID) dropDown.Items.Add(New RadComboBoxItem("50")) dropDown.FindItemByText("50").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID) dropDown.Items.Add(New RadComboBoxItem("100")) dropDown.FindItemByText("100").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID) dropDown.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = True End If If (TypeOf (e.Item) Is GridPagerItem) And e.Item.OwnerTableView.Name = "SubCodes" Then Dim dropDown = DirectCast(e.Item.FindControl("PageSizeComboBox"), RadComboBox) dropDown.Items.Clear() dropDown.Items.Add(New RadComboBoxItem("1")) dropDown.FindItemByText("1").Attributes.Add("ownerTableViewId", e.Item.ClientID) dropDown.Items.Add(New RadComboBoxItem("2")) dropDown.FindItemByText("2").Attributes.Add("ownerTableViewId", e.Item.ClientID) dropDown.Items.Add(New RadComboBoxItem("5")) dropDown.FindItemByText("5").Attributes.Add("ownerTableViewId", e.Item.ClientID) dropDown.Items.Add(New RadComboBoxItem("10")) dropDown.FindItemByText("10").Attributes.Add("ownerTableViewId", e.Item.ClientID) dropDown.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = True End Ifend subThe boxes for my MasterTableView and the DetailsTables come up with the correct entries. When I change the entry in one of my SubCodes DetailTables the system does not recall my RadGrid1_NeedDataSource and refresh the screen. It does if I change the entry in the MasterTableView. I believe it has something to do with assigning the ownerTableViewId to e.Item.ClientID for the SubCodes. What should I be doing. Below is the Page_Init function on how I create the radGrid.
RadGrid1.ID = "RadGrid1" RadGrid1.Width = Unit.Pixel(1500) RadGrid1.Height = Unit.Pixel(700) RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace RadGrid1.AllowPaging = True 'RadGrid1.AllowCustomPaging = True RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric RadGrid1.AutoGenerateColumns = False RadGrid1.ShowStatusBar = True RadGrid1.AllowSorting = True RadGrid1.AllowFilteringByColumn = True RadGrid1.MasterTableView.NoDetailRecordsText = "No records could be found." RadGrid1.MasterTableView.NoMasterRecordsText = "No records could be found." RadGrid1.MasterTableView.ShowHeadersWhenNoRecords = True RadGrid1.Skin = "WebBlue" RadGrid1.ClientSettings.ClientEvents.OnGridCreated = "GetGridObject" RadGrid1.ClientSettings.Scrolling.FrozenColumnsCount = 2 RadGrid1.ClientSettings.AllowColumnsReorder = True RadGrid1.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Swap RadGrid1.ClientSettings.Selecting.AllowRowSelect = True RadGrid1.ClientSettings.Resizing.AllowColumnResize = True RadGrid1.ClientSettings.Scrolling.AllowScroll = True RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = True RadGrid1.ClientSettings.Scrolling.SaveScrollPosition = True RadGrid1.ClientSettings.ClientEvents.OnFilterMenuShowing = "filterMenuShowing" RadGrid1.FilterMenu.OnClientShowing = "MenuShowing" RadGrid1.MasterTableView.PageSize = 100 If ConfigurationManager.AppSettings("geoSelectionGridSize") <> "" Then RadGrid1.MasterTableView.PageSize = ConfigurationManager.AppSettings("geoSelectionGridSize") Else RadGrid1.MasterTableView.PageSize = 50 End If RadGrid1.MasterTableView.AllowMultiColumnSorting = True RadGrid1.MasterTableView.DataKeyNames = New String() {"DetailID", "Day", "FoundGeographies", "SubZipCount"} RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand RadGrid1.MasterTableView.HierarchyDefaultExpanded = True Dim dpCounter As Integer = 1 Dim dpCollection As IList(Of RadListBoxItem) = rlbDistributionPatterns.CheckedItems For Each item As RadListBoxItem In dpCollection Dim columnGroup As New GridColumnGroup columnGroup.HeaderText = item.Text columnGroup.Name = "GroupDP" & dpCounter.ToString columnGroup.HeaderStyle.HorizontalAlign = HorizontalAlign.Center RadGrid1.MasterTableView.ColumnGroups.Add(columnGroup) dpCounter += 1 Next columnCreation("Geography", "Geography", RadGrid1) columnCreation("Circ Type", "CirculationTypeDescription", RadGrid1) columnCreation("Household", "HouseHold_Count", RadGrid1) columnCreation("Total Cov", "TotalCoverage", RadGrid1) If miZipCodeStoreAssociationTypeID > 0 Then columnCreation("Location Market", "LocationMarket", RadGrid1) columnCreation("Location Number", "LocationNumber", RadGrid1) columnCreation("Location Name", "LocationName", RadGrid1) columnCreation("Distance", "Distance", RadGrid1) columnCreation("Sales", "Sales", RadGrid1) columnCreation("Total Sales", "TotalSales", RadGrid1) columnCreation("BOS", "BOS", RadGrid1) columnCreation("Cume BOS", "CumeBOS", RadGrid1) columnCreation("SPH", "SPH", RadGrid1) columnCreation("SPH Index", "SPHIndex", RadGrid1) End If If mstrClientDataCategoryID1Description.Trim <> "" Then columnCreation(mstrClientDataCategoryID1Description.Trim, "CD1", RadGrid1) End If If mstrClientDataCategoryID2Description.Trim <> "" Then columnCreation(mstrClientDataCategoryID2Description.Trim, "CD2", RadGrid1) End If If mstrClientDataCategoryID3Description.Trim <> "" Then columnCreation(mstrClientDataCategoryID3Description.Trim, "CD3", RadGrid1) End If If mstrReportDemographicID1Description.Trim <> "" Then columnCreation(mstrReportDemographicID1Description.Trim, "Demographic1", RadGrid1) End If If mstrReportDemographicID2Description.Trim <> "" Then columnCreation(mstrReportDemographicID2Description.Trim, "Demographic2", RadGrid1) End If If mstrReportDemographicID3Description.Trim <> "" Then columnCreation(mstrReportDemographicID3Description.Trim, "Demographic3", RadGrid1) End If If mstrReportDemographicID4Description.Trim <> "" Then columnCreation(mstrReportDemographicID4Description.Trim, "Demographic4", RadGrid1) End If If mstrReportDemographicID5Description.Trim <> "" Then columnCreation(mstrReportDemographicID5Description.Trim, "Demographic5", RadGrid1) End If columnCreation("Day", "Day", RadGrid1) columnCreation("Selected", "Selected", RadGrid1) If UcHeader.objSession.ApplicationId <> CInt(ConfigurationManager.AppSettings("MediaviewerAppID")) Then columnCreation("Forced", "Forced", RadGrid1) End If columnCreation("Circ", "Circ", RadGrid1) columnCreation("Coverage", "Coverage", RadGrid1) columnCreation("Zones", "Zones", RadGrid1) If UcHeader.objSession.ApplicationId <> CInt(ConfigurationManager.AppSettings("MediaviewerAppID")) Then If miVersionsCategoryID > 0 Then columnCreation("Version", "Version", RadGrid1) columnCreation("Sub-Version Category", "SubVersionCategory", RadGrid1) End If If miDeliveryCodeCount > 0 Then columnCreation("Delivery Code", "DeliveryCode", RadGrid1) End If dpCounter = 1 For Each item As RadListBoxItem In dpCollection columnCreation(item.Text, "DP" & dpCounter.ToString, RadGrid1) columnCreation(item.Text, "CoverageDP" & dpCounter.ToString, RadGrid1) dpCounter += 1 Next End If columnCreation("FoundGeographies", "FoundGeographies", RadGrid1) Dim tableSubCode As New GridTableView(RadGrid1) tableSubCode.Name = "SubCodes" tableSubCode.DataKeyNames = New String() {"SubCodeID", "Day", "CirculationTypeDescription", "FoundGeographies"} tableSubCode.Width = Unit.Percentage(100) tableSubCode.AllowFilteringByColumn = False dpCounter = 1 For Each item As RadListBoxItem In dpCollection Dim columnGroup As New GridColumnGroup columnGroup.HeaderText = item.Text columnGroup.Name = "GroupDP" & dpCounter.ToString columnGroup.HeaderStyle.HorizontalAlign = HorizontalAlign.Center tableSubCode.ColumnGroups.Add(columnGroup) dpCounter += 1 Next 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 dpCounter = 1 For Each item As RadListBoxItem In dpCollection columnSubCodeCreation(item.Text, "DP" & dpCounter.ToString, tableSubCode) columnSubCodeCreation(item.Text, "CoverageDP" & dpCounter.ToString, tableSubCode) dpCounter += 1 Next End If Me.PlaceHolder1.Controls.Add(RadGrid1)