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

Max Length in Edit Mode

2 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 18 Mar 2009, 02:37 PM
Hi All

I have a radgrid

Automatic Edit/Update/Insert/Delete

While clicking the edit symbol

text boxes appears.

But in my database I have set the maxlength to 50

But here I am able to type more than that.

Is there any possible way to set the maximum limit in Edit Mode.

Thank You

-Anto

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 19 Mar 2009, 05:13 AM
Hello Anto,

You can try out the following code to set the maxlength of a textbox for a column when the grid row is in edit mode:
cs:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
     if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
        { 
            GridEditFormItem editItem = (GridEditFormItem)e.Item; 
            TextBox txtbx = (TextBox)editItem["ColumnUniqueName"].Controls[0]; 
            txtbx.MaxLength = 50; 
       } 
   } 

Thanks
Princy.
0
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
answered on 19 Mar 2009, 06:48 AM
Thank u Princy

Problem is solved

-Anto
Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Share this question
or