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

RadGrid dropdown filter

3 Answers 1590 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahesh
Top achievements
Rank 1
Mahesh asked on 13 Aug 2013, 02:48 PM
Hi All,

How to bind a dropdown in radgrid filter template in codebehind page? Please help

Thanks,
Mahesh

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Aug 2013, 07:56 AM
Hi Mahesh,

Please try the below code snippet to bind a RadComboBox in filter template.

ASPX:
<telerik:GridBoundColumn UniqueName="ContactTitle" DataField="ContactTitle" HeaderText="Contact title"                       HeaderStyle-Width="200px">
  <FilterTemplate>
    <telerik:RadComboBox ID="RadComboBox1" runat="server"></telerik:RadComboBox>
  </FilterTemplate>
</telerik:GridBoundColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
   {
       if (e.Item is GridFilteringItem)
      {
          GridFilteringItem item = (GridFilteringItem)e.Item;
          RadComboBox combo = (RadComboBox)item.FindControl("RadCombobox1");
          combo.DataSourceID = "SqlDataSource2";
          combo.DataTextField="ContactTitle";
          combo.DataValueField = "ContactTitle";         
      }
   }

Thanks,
Princy
0
sukhwinder
Top achievements
Rank 1
answered on 22 Mar 2017, 06:38 PM

Hi, 

how do i filter data based on selected values in the above RadComboBox 

 

Thanks

0
Eyup
Telerik team
answered on 27 Mar 2017, 07:36 AM
Hello Sukhwinder,

Generally, you can check the implementation provided in the following live sample:
http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/filter-templates/defaultcs.aspx

You can also find some nice runnable examples here:
http://www.telerik.com/forums/how-to-persist-dropdownlist-selected-index-and-value-on-postback-from-radgrid-filtertemplate#GW3MyQLmVEmy8XzsmrHzeQ

I hope this will prove helpful.


Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Mahesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
sukhwinder
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or