Hi,
I Have an imge column in rad grid. I want to apply custom filter to filter the records on the basis of image name as default filter function available are not of my use.
I want to keep the new menu items on filter menu for that column only and rest of column in grid will be using the default filter function by using allowing filter=true.
Please suggest how to achieve this.Help on this would be highly appreciated.
Thanks,
Manjeet
I Have an imge column in rad grid. I want to apply custom filter to filter the records on the basis of image name as default filter function available are not of my use.
I want to keep the new menu items on filter menu for that column only and rest of column in grid will be using the default filter function by using allowing filter=true.
Please suggest how to achieve this.Help on this would be highly appreciated.
Thanks,
Manjeet
3 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 03 Nov 2011, 05:44 AM
Hello Manjeet,
Check the following help documentation which explains custom filtering.
Custom Option for Filtering (FilterListOptions -> VaryByDataTypeAllowCustom).
Thanks,
Shinu.
Check the following help documentation which explains custom filtering.
Custom Option for Filtering (FilterListOptions -> VaryByDataTypeAllowCustom).
Thanks,
Shinu.
0

Manjeet
Top achievements
Rank 1
answered on 03 Nov 2011, 08:26 AM
Thanks for your reply bt this doesn't seems to solve my problem.
I want to replace the default grid Filter Text box with combo box that contains a new list of item for which i need to create a filter on my image column.rest of columns should be using default filter.
When I'll select an Item from Combo box a search filter should be created that will search the results with image name as selected in combo box.
Please let me know if you are not clear on this.
Thanks,
Manjeet
I want to replace the default grid Filter Text box with combo box that contains a new list of item for which i need to create a filter on my image column.rest of columns should be using default filter.
When I'll select an Item from Combo box a search filter should be created that will search the results with image name as selected in combo box.
Please let me know if you are not clear on this.
Thanks,
Manjeet
0

Manjeet
Top achievements
Rank 1
answered on 03 Nov 2011, 11:57 AM
Hi,
I am able to bring the combo box in filtering item over my images column but i am not able to write the filter expression that would filter the images based on the Image name selected in combo box.
I am able to bring the combo box in filtering item over my images column but i am not able to write the filter expression that would filter the images based on the Image name selected in combo box.
protected void OnItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridFilteringItem)
{
GridFilteringItem filteringItem = e.Item as GridFilteringItem;
//set ImageUrl which points to your custom image and attach its onclick event
filteringItem["Image"].Controls.Clear();
RadComboBox radMenu = new RadComboBox();
radMenu.ID="filterCombo";
radMenu.Width = 100;
radMenu.AutoPostBack = true;
RadComboBoxItem item0 = new RadComboBoxItem("No Filter", "All");
RadComboBoxItem item1 = new RadComboBoxItem("Diary", "Diary");
RadComboBoxItem item2 = new RadComboBoxItem("Task", "Task");
RadComboBoxItem item3 = new RadComboBoxItem("Group", "Group");
//ImageButton filterImage = new ImageButton();
if (radMenu.Items.Count == 0)
{
radMenu.Items.Add(item0);
radMenu.Items.Add(item1);
radMenu.Items.Add(item2);
radMenu.Items.Add(item3);
}
//filteringItem.Controls.RemoveAt(1); //combo.OnClientSelectedIndexChanged = "FilterRecords(sender,e)";
//filteringItem.Controls.Add(combo);
filteringItem["Image"].Controls.Add(radMenu);
radMenu.SelectedIndexChanged += new Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventHandler(ComboChangedEvent);
}
}
protected void ComboChangedEvent(object sender,EventArgs e)
{
GridColumn column;
column = lstDiary.MasterTableView.GetColumnSafe("Image");
switch (((Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)(e)).Value)
{
case "Diary":
lstDiary.MasterTableView.FilterExpression = "([Image] = 'Self.gif')";
column.CurrentFilterFunction = GridKnownFunction.EqualTo;
column.CurrentFilterValue = "Self.gif";
lstDiary.Rebind();
break;
case "Task":
lstDiary.MasterTableView.FilterExpression = "([Image] = 'Task')";
column.CurrentFilterFunction = GridKnownFunction.EqualTo;
column.CurrentFilterValue ="Task";
lstDiary.Rebind();
break;
case "All":
lstDiary.MasterTableView.FilterExpression = String.Empty;
column.CurrentFilterFunction = GridKnownFunction.IsEmpty;
column.CurrentFilterValue = String.Empty;
lstDiary.Rebind();
break;
default:
break;
}
}
Please Help.