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

[Solved] MaxLength for FilterControl-Text

2 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dominic
Top achievements
Rank 1
Dominic asked on 10 Jul 2009, 07:11 AM
Hello,

is there a way to set the MaxLength for the text in the FilterControl of a GridBoundColumn?

Best Regards

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Jul 2009, 08:30 AM
Hi domenic,

Try the follong code snippet to set the MaxLength property of filtercontrol of GridBoundColumn.

ASPX:
 
<telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" UniqueName="CompanyName">  
</telerik:GridBoundColumn> 

C#:
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    if (e.Item is GridFilteringItem)  
    {  
        GridFilteringItem filterItem = (GridFilteringItem)e.Item;  
        TextBox textBox = (TextBox)filterItem["CompanyName"].Controls[0];  
        textBox.MaxLength = 5; // Set desired value for MaxLength  
    }  

Thanks,
Princy.
0
Dominic
Top achievements
Rank 1
answered on 10 Jul 2009, 09:03 AM
Hi Princy,

it works fine.

Thanks,
Dominic
Tags
Grid
Asked by
Dominic
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Dominic
Top achievements
Rank 1
Share this question
or