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

Preserving filter text

2 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Riaan
Top achievements
Rank 1
Riaan asked on 26 Feb 2009, 11:50 AM

Hey there,

I am listing users in the grid that are part of a domain e.g. Telerik\John.....However, I am finding great difficulty in filtering for values as the user needs to type in two \\ for the search to return correct data. I cannot tel the user to type in two \\ as they would not want that and well, you know users :) So, I tried the onneeddatasource event, onpageload etc to changethe FilterExpression, the problem is, by the time I can access the filterexpression, telerik has already romoved the one \ and it searches for Telerikjohn.

Please help!!!!

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 27 Feb 2009, 10:41 AM
i Riaan,

I was also able to replicate the issue on my end. I am not sure why the back slash is getting removed. But i found a work around and here is the code snippet.

CS:
 public string filterText = String.Empty ; 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        
        foreach (GridFilteringItem filter in RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)) 
        { 
            TextBox txtbx = (TextBox)filter["columnUniqueName"].Controls[0]; 
            filterText = txtbx.Text; 
            
        } 
    } 
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "Filter"
        { 
            GridFilteringItem filter = (GridFilteringItem)e.Item; 
            TextBox txtbx = (TextBox)filter["columnUniqueName"].Controls[0]; 
            txtbx.Text = filterText; 
 
        } 
    } 



Just give a try with the above code and see if it helps.

Regards
Shinu


0
Riaan
Top achievements
Rank 1
answered on 02 Mar 2009, 06:23 AM

Hi Shinu,

That solved the problem thanks alot!!!!

Riaan

Tags
Grid
Asked by
Riaan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Riaan
Top achievements
Rank 1
Share this question
or