Hi,
I need to modify the filter for radgrid.
As per the requirement i have to use different filter option for different column and reduce the filter option(only contain filter) for default radgrid headercontect type of filter.
Please find the requirement and current implement of rad grid filter.
Any sample code with be greatly helpful.
Thanks.
4 Answers, 1 is accepted
code in aspx page
<telerik:RadGrid
runat="server"
ID="gvSiteInventory"
AllowPaging="false"
SelectionMode="FullRowSelect"
AllowMultiRowSelection="true"
ShowHeader="True"
AllowSorting="True"
AllowFilteringByColumn="true"
EnableHeaderContextMenu="true"
FilterType="HeaderContext"
AutoGenerateColumns="false" GroupingEnabled="false"
EnableHeaderContextFilterMenu="true"
OnFilterCheckListItemsRequested="gvSiteInventory_FilterCheckListItemsRequested">
<MasterTableView AllowPaging="True" PageSize="50">
<Columns>
<telerik:GridBoundColumn DataField="SiteName" AllowFiltering="true"
UniqueName="SiteName1" HeaderText="Site Name" AllowSorting="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Department"
UniqueName="Department1" HeaderText="Department"
AllowSorting="true" AllowFiltering="true" FilterCheckListEnableLoadOnDemand="true" >
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Code in cs file
protected void Page_Load(object sender, EventArgs e)
{
BindGridView();
}
private void BindGridView()
{
gvSiteInventory.DataSource = Utilities.GetSiteInventoryDetails();
gvSiteInventory.DataBind();
}
protected void gvSiteInventory_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
{
string DataField = (e.Column as IGridDataColumn).GetActiveDataField();
e.ListBox.DataSource = Utilities.GetSiteInventoryDetails();
e.ListBox.DataKeyField = DataField;
e.ListBox.DataTextField = DataField;
e.ListBox.DataValueField = DataField;
e.ListBox.DataBind();
}
For SiteName column only contain filter with sorting is required and for Department column checkbox filter with sorting only required.
Thanks.
I am afraid that customizing HeaderContext filter menu with the current version of RadGrid control is not supported. Sorry for the inconvenience caused.
Regards,
Pavlina
Telerik
Hi, I have customized the Header Context filter. Current issue is that for particular row particular filter option i have to show.
For checkbox column i have to hide "FilterMenuParent" option (find the attachment).
Also clear button is not working for checkbox column.
Please reply ASAP.
Thanks,
Anand Kumar
Please review the support ticket you have opened for the same issues.
Regards,
Maria Ilieva
Telerik