Hello,
I want to users to be able to filter on the results in our radgrid. I enabled AllowFilteringbycolumn = "true' on my radgrid, but whenever I enter a value into the new radgrid filter boxes the loading panel spins and nothing changes. I have a searchbox that allows the user to search for their items. After that initial query returns, I want them to be able to filter on any column in the grid. So for instance if the results show all of their items, but they want to see all of them in building 1, they should be able to enter 1 into the filter textbox on the grid. How can I make this happen?
Thank you!
<telerik:RadGrid ID="RadGrid1" runat="server" EnableLinqExpressions="false" AutoGenerateColumns="true" Skin="WebBlue" AllowPaging="true" AllowSorting="true" CellSpacing="0" GridLines="Both" OnNeedDataSource="NeedDataSource" PageSize="50" OnPreRender="RadGrid1_PreRender" AllowMultiRowSelection="false" AllowFilteringByColumn="true">
<PagerStyle Mode="NextPrevAndNumeric" />
<ItemStyle CssClass="UsePointer" />
<MasterTableView CommandItemDisplay="bottom">
<SortExpressions><telerik:GridSortExpression FieldName="assetTag" SortOrder="Ascending" /></SortExpressions>
<Columns>
<telerik:GridTemplateColumn HeaderStyle-CssClass="commandHeader" HeaderStyle-Width="30px" Exportable="false" UniqueName="checkCol">
<HeaderTemplate>
<asp:CheckBox ID="checkAll" runat="server" onclick="CheckAll(this)" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="cboxSelect" runat="server" onclick="unCheckHeader(this); enableMassUpdate()" OnCheckedChanged="GridCheckBoxChanged" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<CommandItemSettings ShowExportToExcelButton="false" ShowAddNewRecordButton="false" ShowRefreshButton="false"/>
</MasterTableView>
<ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true" >
<Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowSelecting="RowSelecting" OnRowSelected="RowSelected" OnCommand="ClearForm" />
<KeyboardNavigationSettings EnableKeyboardShortcuts="false" AllowSubmitOnEnter="false" AllowActiveRowCycle="false" ></KeyboardNavigationSettings>
</ClientSettings>
</telerik:RadGrid>
protected void NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
(source as RadGrid).DataSource = getDataGrid("RadGrid1");
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridColumn checkCol = RadGrid1.MasterTableView.GetColumnSafe("checkCol");
checkCol.OrderIndex = 1;
GridColumn assetDeptCol = RadGrid1.MasterTableView.GetColumn("itemDept");
assetDeptCol.HeaderStyle.Width = Unit.Pixel(115);
assetDeptCol.HeaderText = "item Department";
assetDeptCol.OrderIndex = 2;
GridColumn assetTagCol = RadGrid1.MasterTableView.GetColumn("itemTag");
assetTagCol.HeaderStyle.Width = Unit.Pixel(100);
assetTagCol.HeaderText = "itemTag";
assetTagCol.OrderIndex = 3;
GridColumn employeeCol = RadGrid1.MasterTableView.GetColumn("employee");
employeeCol.HeaderStyle.Width = Unit.Pixel(280);
employeeCol.HeaderText = "Employee";
employeeCol.OrderIndex = 4;
GridColumn buildingCol = RadGrid1.MasterTableView.GetColumn("building");
buildingCol.HeaderStyle.Width = Unit.Pixel(100);
buildingCol.HeaderText = "Building";
buildingCol.OrderIndex = 6;
GridColumn floorCol = RadGrid1.MasterTableView.GetColumn("floor");
floorCol.HeaderStyle.Width = Unit.Pixel(70);
floorCol.HeaderText = "Floor";
floorCol.OrderIndex = 7;
GridColumn roomCol = RadGrid1.MasterTableView.GetColumn("room");
roomCol.HeaderStyle.Width = Unit.Pixel(150);
roomCol.HeaderText = "Room";
roomCol.OrderIndex = 8;
RadGrid1.Rebind();
}
}
I want to users to be able to filter on the results in our radgrid. I enabled AllowFilteringbycolumn = "true' on my radgrid, but whenever I enter a value into the new radgrid filter boxes the loading panel spins and nothing changes. I have a searchbox that allows the user to search for their items. After that initial query returns, I want them to be able to filter on any column in the grid. So for instance if the results show all of their items, but they want to see all of them in building 1, they should be able to enter 1 into the filter textbox on the grid. How can I make this happen?
Thank you!
<telerik:RadGrid ID="RadGrid1" runat="server" EnableLinqExpressions="false" AutoGenerateColumns="true" Skin="WebBlue" AllowPaging="true" AllowSorting="true" CellSpacing="0" GridLines="Both" OnNeedDataSource="NeedDataSource" PageSize="50" OnPreRender="RadGrid1_PreRender" AllowMultiRowSelection="false" AllowFilteringByColumn="true">
<PagerStyle Mode="NextPrevAndNumeric" />
<ItemStyle CssClass="UsePointer" />
<MasterTableView CommandItemDisplay="bottom">
<SortExpressions><telerik:GridSortExpression FieldName="assetTag" SortOrder="Ascending" /></SortExpressions>
<Columns>
<telerik:GridTemplateColumn HeaderStyle-CssClass="commandHeader" HeaderStyle-Width="30px" Exportable="false" UniqueName="checkCol">
<HeaderTemplate>
<asp:CheckBox ID="checkAll" runat="server" onclick="CheckAll(this)" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="cboxSelect" runat="server" onclick="unCheckHeader(this); enableMassUpdate()" OnCheckedChanged="GridCheckBoxChanged" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<CommandItemSettings ShowExportToExcelButton="false" ShowAddNewRecordButton="false" ShowRefreshButton="false"/>
</MasterTableView>
<ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true" >
<Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowSelecting="RowSelecting" OnRowSelected="RowSelected" OnCommand="ClearForm" />
<KeyboardNavigationSettings EnableKeyboardShortcuts="false" AllowSubmitOnEnter="false" AllowActiveRowCycle="false" ></KeyboardNavigationSettings>
</ClientSettings>
</telerik:RadGrid>
protected void NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
(source as RadGrid).DataSource = getDataGrid("RadGrid1");
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridColumn checkCol = RadGrid1.MasterTableView.GetColumnSafe("checkCol");
checkCol.OrderIndex = 1;
GridColumn assetDeptCol = RadGrid1.MasterTableView.GetColumn("itemDept");
assetDeptCol.HeaderStyle.Width = Unit.Pixel(115);
assetDeptCol.HeaderText = "item Department";
assetDeptCol.OrderIndex = 2;
GridColumn assetTagCol = RadGrid1.MasterTableView.GetColumn("itemTag");
assetTagCol.HeaderStyle.Width = Unit.Pixel(100);
assetTagCol.HeaderText = "itemTag";
assetTagCol.OrderIndex = 3;
GridColumn employeeCol = RadGrid1.MasterTableView.GetColumn("employee");
employeeCol.HeaderStyle.Width = Unit.Pixel(280);
employeeCol.HeaderText = "Employee";
employeeCol.OrderIndex = 4;
GridColumn buildingCol = RadGrid1.MasterTableView.GetColumn("building");
buildingCol.HeaderStyle.Width = Unit.Pixel(100);
buildingCol.HeaderText = "Building";
buildingCol.OrderIndex = 6;
GridColumn floorCol = RadGrid1.MasterTableView.GetColumn("floor");
floorCol.HeaderStyle.Width = Unit.Pixel(70);
floorCol.HeaderText = "Floor";
floorCol.OrderIndex = 7;
GridColumn roomCol = RadGrid1.MasterTableView.GetColumn("room");
roomCol.HeaderStyle.Width = Unit.Pixel(150);
roomCol.HeaderText = "Room";
roomCol.OrderIndex = 8;
RadGrid1.Rebind();
}
}