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

Need To Set The Width In EditMode

2 Answers 159 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, 01:20 PM
Hi All

I have a radgrid.

Automatic Update/Insert/Delete

When the Edit button is clicked

The text boxes appears

But its width differs for each record.

I want to make it stable, Is there any possibility.

Thank you

-Anto

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 18 Mar 2009, 01:36 PM
Hello Anto,

You can either set the textbox width of the GridBoundColumn when it is in edit mode as shown below:

  protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
    {  
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))  
        {  
            GridEditableItem edititem = (GridEditableItem)e.Item;  
            TextBox txtbx = (TextBox)edititem["ColumnUniqueName"].Controls[0];  
            txtbx.Width = Unit.Pixel(100);  
        }   
          
    }  

Or you can set column editors for various columns and set their styles declaratively. Refer to the following help document for more information:
Declarative style editors

Thanks
Princy.
0
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
answered on 18 Mar 2009, 02:13 PM
Hi Princy

Thank You. My 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