I have a RadGrid whose skeleton is defined in the aspx page but the columns are defined at runtime.
The columns are added when the user hits filter button, which shows only the columns that the user wants to see.
Now when I change the value in PageSize textbox in the pager section and click the button, the page size does not change. However, if I define the columns manually in the design page itself and not dynamically then it works fine.
So I added a OnPageSizeChanged event but it doesn't get fired. I haven't tried this with undynamic columns.
Thanks.
<telerik:RadGrid ID="rgResult" runat="server" CellPadding="2" CellSpacing="2" AutoGenerateColumns="false" EnableViewState="false" AllowPaging="true" PageSize="25" AllowSorting="true" AllowMultiRowSelection="true" OnItemDataBound="rgResult_ItemDataBound" OnSortCommand="rgResult_SortCommand"> <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="Bottom"></PagerStyle> <ClientSettings EnableRowHoverStyle="true"> <Selecting AllowRowSelect="true"></Selecting> <ClientEvents OnRowSelected="RowSelected" OnRowDeselected="RowDeselected" /> </ClientSettings></telerik:RadGrid>The columns are added when the user hits filter button, which shows only the columns that the user wants to see.
private void DesignRadGrid(){ rgResult.MasterTableView.Columns.Clear(); var arrColumns = GetSelectedColumns(); var arrPropertyInfo = typeof(MyObject).GetProperties(BindingFlags.Public | BindingFlags.Instance); var vColumns = from col in arrColumns.AsParallel().AsOrdered() join pi in arrPropertyInfo.AsParallel() on col.Name equals pi.Name select new { col.ColumnId, col.DisplayName, col.Name }; foreach (var oColumn in vColumns) { var boundColumn = new GridBoundColumn { HeaderText = oColumn.DisplayName, DataField = oColumn.Name, SortExpression = oColumn.Name }; ... (format field according to datatype) ... rgResult.MasterTableView.Columns.Add(boundColumn); }}Now when I change the value in PageSize textbox in the pager section and click the button, the page size does not change. However, if I define the columns manually in the design page itself and not dynamically then it works fine.
So I added a OnPageSizeChanged event but it doesn't get fired. I haven't tried this with undynamic columns.
Thanks.