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

Rad Grid Filter Issue in filter option with " ' "

3 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 05 Oct 2009, 01:20 PM
HI , 
    I am using Rad Telrik 2008 Controls . I am using the Rad grid with Filter option i am binding teh Grdi data with my own Business layer functions. It is working fine for all filter options. but when i am filtering the column data with  "  '  "(Single Course), it is throing some type of error. it is working fine in Mozella But not in IE. Please sugeste me  i also check all related forums thread but not able to find the actual issue,

Thanks With Regard
Victor

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 07 Oct 2009, 02:23 PM
Hello Victor,

What exception does it throw? This problem might originate from the ' breaking your filter expression. Try escaping it with \

Greetings,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Victor
Top achievements
Rank 1
answered on 07 Oct 2009, 04:09 PM
i get any type of java script error. During teh debussing time it show the error in Telrik Dll file (file looking like javascrit file). it is in DLL. the main concer is that i am not able to filter the data with " ' " (Single Course). I am using Rad telrik 2009 Q1  web controls

But for other values in filter field it is working fine
0
Shinu
Top achievements
Rank 2
answered on 08 Oct 2009, 06:29 AM
Hi Victor,

One suggestion would be preventing the user to type " ' " in filter textbox. Try the following code in order to achieve this.

C#:
 
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)   
{   
    if (e.Item is GridFilteringItem)   
    {   
        GridFilteringItem fItem = (GridFilteringItem)e.Item;   
        foreach (GridColumn col in RadGrid1.MasterTableView.Columns)   
        {   
            (fItem[col.UniqueName].Controls[0] as TextBox).Attributes.Add("onkeyup""Backslash(this, event)");   
        }   
    }   
}  

JavaScript:
 
<script type="text/javascript">  
function backslash(text,e)  
{  
  var regx, flg;    
    regx = /[']/    
    flg = regx.test(text.value);    
    if (flg)  
    {    
        var val=text.value;  
        val=val.substr(0,(val.length)-1)  
        text.value=val;        
    }  
}  
</script>  

Hope this helps,
Shinu.
Tags
Grid
Asked by
Victor
Top achievements
Rank 1
Answers by
Veli
Telerik team
Victor
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or