This is a migrated thread and some comments may be shown as answers.

Remove grid filters

1 Answer 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Abhishek
Top achievements
Rank 1
Abhishek asked on 25 Apr 2011, 12:36 PM
Hi team,
My radgrid has its auto genereate column set to true. And I have a serial number column in it.
I want to hide filter for serial number column only and want rest of columns to retain filters. Please help in acheiving this features.
I am attaching gridview for your reference.
<telerik:RadGrid ID="gvPreview" AutoGenerateColumns="true" AllowPaging="True" PageSize="10"
                             runat="server" GridLines="vertical" Width="99%" AllowSorting="true" OnPreRender="gvPreview_PreRender"
                            Font-Bold="true" EnableViewState="true"
                             EnableTheming="false" Height="380px" AllowFilteringByColumn="true" OnPageIndexChanged="gvPreview_PageIndexChanged"
                             OnNeedDataSource="gvPreview_NeedDataSource" OnPageSizeChanged="gvPreview_PageSizeChanged">
                             <ExportSettings HideStructureColumns="true" IgnorePaging="true" OpenInNewWindow="true"
                                 ExportOnlyData="true">
                             </ExportSettings>
                             <GroupingSettings CaseSensitive="false" />
                           <ItemStyle CssClass="grid-content-Maintext" HorizontalAlign="Left" ForeColor="Black"
                     VerticalAlign="Middle" BackColor="#f4fdff"></ItemStyle>
                 <AlternatingItemStyle CssClass="grid-content-Alttext" HorizontalAlign="Left" ForeColor="Black"
                     VerticalAlign="Top" BackColor="White" />
                 <HeaderStyle CssClass="background_dbf7ff lineHeight_25px" Font-Bold="True"
                     HorizontalAlign="Left" Wrap="true" ForeColor="Black" VerticalAlign="Middle"
                     BackColor="#f4fdff"  Font-Names="Arial" Font-Size="11px" />
                 <PagerStyle CssClass="background_dbf7ff lineHeight_25px" />
                 <SelectedItemStyle CssClass="background_dbf7ff lineHeight_25px" />
                 <GroupHeaderItemStyle CssClass="background_dbf7ff lineHeight_25px" />
                 <ActiveItemStyle CssClass="background_dbf7ff lineHeight_25px" />
                 <CommandItemStyle CssClass="background_dbf7ff lineHeight_25px" />
                 <SortingSettings EnableSkinSortStyles="False" />
                 <FilterItemStyle BackColor="#DBF7FF"  BorderStyle="Solid" />
                 <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />  
 
 
 
                             <MasterTableView Width="100%" CommandItemDisplay="Top" CommandItemStyle-HorizontalAlign="Right">
                                 <PagerStyle Mode="NextPrevAndNumeric" />
                                 <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
                                     ShowRefreshButton="false" />
                             </MasterTableView>
                             <ClientSettings AllowDragToGroup="true" AllowColumnsReorder="true" ReorderColumnsOnClient="true"
                                 ColumnsReorderMethod="Reorder">
                                  
                                 <Animation AllowColumnReorderAnimation="true" AllowColumnRevertAnimation="true" />
                                 <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                                 </Scrolling>
                             </ClientSettings>
                             <PagerStyle AlwaysVisible="true"></PagerStyle>
                         </telerik:RadGrid>


Thanks,
Abhishek

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 25 Apr 2011, 02:32 PM
Hello Abhishek,

You can handle ColumnCreated event and set AllowFiltering property to false for the desired column:
C#
protected void RadGrid1_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
    {
        if (e.Column.UniqueName == "ColumnUniqueName")
        {
            GridBoundColumn boundColumn = e.Column as GridBoundColumn;
            boundColumn.AllowFiltering = false;
        }
    }

Greetings,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Abhishek
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or