Wight of field in GridBoundColumn

4 posts, 0 answers
  1. Bertrand Dessaintes
    Bertrand Dessaintes avatar
    13 posts
    Member since:
    Apr 2008

    Posted 05 Feb 2009 Link to this post

    Hello, is it possible to change the width of edit text field in GridBoundColumn under make a templatecolumn ?

    Thx you
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Feb 2009 Link to this post

    Hello Bertrand,

    To change the width of a boundcolumn textbox when the grid is in EditMode( using EditFrom), you can try the following code:
    aspx:
     <telerik:GridBoundColumn DataField="ProductName" HeaderText="Product Name" UniqueName="ProductName" > 
     </telerik:GridBoundColumn> 
           

    cs:
     protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e) 
        {  
           if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
            { 
                GridEditableItem editItem = (GridEditableItem)e.Item; 
                TextBox txtbx = (TextBox)editItem["ProductName"].Controls[0]; 
                txtbx.Width=Unit.Pixel(50);           
            } 
        } 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bertrand Dessaintes
    Bertrand Dessaintes avatar
    13 posts
    Member since:
    Apr 2008

    Posted 05 Feb 2009 Link to this post

    Thank you but you have no this possibility in properties in the control GridDatabound ?

    Thk you.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Feb 2009 Link to this post

    Hi Bertrand,

    It is not possible to set the width of the edit mode BoundColumn TextBox directly on the aspx. But you can set the custom style editors for columns declaratively by setting the ColumnEditorID property of the corresponding column to the ID of the custom column editor. For more information on this, refer to the following help document:
    Declarative style editors

    Thanks
    Princy.
Back to Top