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

insert/edit form width

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cyrus
Top achievements
Rank 1
Cyrus asked on 25 Feb 2009, 05:35 PM
I am having a really hard time trying to figure out how to specify the width of a textbox in the insert/edit forms of a grid.  This should be really, really easy...but I can't figure it out.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Feb 2009, 03:58 AM
Hello Cyrus,

You can set the width of a textbox in edit mode dynamically, using the following code:
cs:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
    {  
      if (e.Item is GridEditFormItem && e.Item.IsInEditMode)  
       {  
          GridEditFormItem edititem = (GridEditFormItem)e.Item;  
          TextBox textBox = (TextBox)edititem["ColumnUniqueName"].Controls[0];  
          textBox.Width = Unit.Pixel(50);  
       }            
    }  

Another alternative is to set custom column editors declaratively, specifying width and other attributes. Check out the following help link to achieve the same:
Declarative style editors

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