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

Custom Filter Errors

4 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon-Jon Kershaw
Top achievements
Rank 2
Jon-Jon Kershaw asked on 09 Feb 2009, 05:00 PM
I just don't know what I need.  I followed the directions in the Online Help page.  All errors are bold, italicized, and underlined.  Thanks in advance.

  protected void Page_Init(object sender, System.EventArgs e)  
    {  
        RadGridZoneList.FilterMenu.Items.Clear();  
        RadMenuItem menuItem = new RadMenuItem();  
        RadGridZoneList.FilterMenu.Items.Add(menuItem);  
        menuItem.Text = "Custom-Text (Contains)";  
        menuItem.Value = "Contains";  
        (RadGridZoneList.FilterMenu as GridFilterMenu).OnClick += new RadMenuEventHandler(FilterMenu_OnClick);  
    }  
    protected void FilterMenu_OnClick(object sender, RadMenuEventArgs e)  
    {  
        GridFilteringItem filterItem = RadGridZoneList.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;  
        filterItem.FireCommandEvent("Filter", new Pair(e.Item.Value, e.Item.Attributes["columnUniqueName"]));  
    }  

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Feb 2009, 09:33 AM
Hi,

Give a try with the following code snippet and see whether it helps.

CS:
protected void Page_Init(object sender, System.EventArgs e) 
    { 
        RadGridZoneList.FilterMenu.Items.Clear(); 
        RadMenuItem menuItem = new RadMenuItem(); 
        RadGridZoneList.FilterMenu.Items.Add(menuItem); 
        menuItem.Text = "Custom-Text (Contains)"
        menuItem.Value = "Contains"
        GridFilterMenu menu = (GridFilterMenu)RadGridZoneList.FilterMenu; 
        (RadGridZoneList.FilterMenu as GridFilterMenu).ItemClick += new RadMenuEventHandler(FilterMenu_ItemClick); 
    } 
 
    void FilterMenu_ItemClick(object sender, RadMenuEventArgs e) 
    { 
        GridFilteringItem filterItem = RadGridZoneList.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem; 
          filterItem.FireCommandEvent("Filter"new Pair(e.Item.Value, e.Item.Attributes["columnUniqueName"])); 
    } 


Thanks
Shinu
0
Jon-Jon Kershaw
Top achievements
Rank 2
answered on 10 Feb 2009, 05:53 PM

Now getting......
Error 7 The type or namespace name 'RadMenuEventArgs' could not be found (are you missing a using directive or an assembly reference?) 
Error 8 error CS0246: The type or namespace name 'RadMenuEventArgs' could not be found (are you missing a using directive or an assembly reference?)  

Thanks again.

0
Shinu
Top achievements
Rank 2
answered on 11 Feb 2009, 04:03 AM
Hi Jon,

Are you using  RadGrid for asp.net or RadGrid for asp.net AJAX?  I am using RadGrid for asp.net  AJAX version(2008.3.1314.20). This code is working fine on my end.

Thanks
Shinu
0
Jon-Jon Kershaw
Top achievements
Rank 2
answered on 11 Feb 2009, 03:04 PM
i went to the design tab and clicked on the RadGrid Tasks arrow on the top right then click open property builder it opens up the correct window for use witht the RadGrid. 

Hmmmm...opened it this morning and compiled...and it works.  Crazy computers.....i seriously think mine has AI properties.

thanks Shinu.

jonathan.
Tags
Grid
Asked by
Jon-Jon Kershaw
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Jon-Jon Kershaw
Top achievements
Rank 2
Share this question
or