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

Replace Filter text box with a Button in Grid Filtering

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gowtham
Top achievements
Rank 1
Gowtham asked on 06 Jun 2012, 05:03 PM
Hi All,

I saw this post "Google like Filtering" using RadGrid in the below link.

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandcombo/defaultcs.aspx?product=grid 

It's something like filtering with a text box below the Grid's header..

I need to have 5 columns in my grid..For the first 3 columns alone i should have this filtering option. For the 4th and 5th column i should have a button in place of Filter box(TextBox).. On that button click i need to accomplish certain tasks too..

Any idea on how to do this will help me.



1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Jun 2012, 04:27 AM
Hello Gowtham,

One suggestion is you can use FilterTemplate for the particular column where you need to show the button. Here is the sample code.
aspx:
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1"runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true">
 <MasterTableView CommandItemDisplay="Top" DataKeyNames="EmployeeID" >
   <Columns>
      <telerik:GridBoundColumn  DataField="FirstName" UniqueName="FirstName" HeaderText="FirstName"></telerik:GridBoundColumn>
      <telerik:GridBoundColumn AllowFiltering="true"  DataField="EmployeeID" HeaderText="EmployeeID" UniqueName="EmployeeID">
        <FilterTemplate>
           <asp:Button ID="Button1" runat="server" Text="Filter" onclick="Button1_Click" />
        </FilterTemplate>
      </telerik:GridBoundColumn>
   </Columns>
 </MasterTableView>
</telerik:RadGrid>
C#:
protected void Button1_Click(object sender, EventArgs e)
{//your logic here
}

Thanks,
Shinu.
Tags
Grid
Asked by
Gowtham
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or