Edit mode column width

5 posts, 1 answers
  1. Minh
    Minh avatar
    61 posts
    Member since:
    Jun 2011

    Posted 08 Aug 2011 Link to this post


    I'm looking for the edit mode width setting for numeric columns.......the my edit mode numeric columns are much wider than needed. The following is my code.



    <telerik:GridNumericColumn DecimalDigits="2"

    FilterControlAltText="Filter SalesLinePressure column"

    HeaderText="Sales Line Pressure (psig)" UniqueName="SalesLinePressure" DataField="Sales_Line_Pressure" FilterControlWidth="20px" >

    <HeaderStyle Width="50px" />

    <ItemStyle Width="50px" />

    <FooterStyle Width="50px" />


    Minh Bui


  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 08 Aug 2011 Link to this post

    Hello Minh,

    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
       if ((e.Item.OwnerTableView.IsItemInserted && e.Item is GridEditFormInsertItem))
         ((TextBox)((GridEditFormInsertItem)e.Item)["SalesLinePressure"].Controls[0]).Width = Unit.Pixel(85);

    Jayesh Goyani
  3. DevCraft R3 2016 release webinar banner
  4. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Aug 2011 Link to this post

    Hello Minh,

    You can try the following code snippet to change the width of NUmericColumn in edit mode.

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
         if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                GridEditableItem item = (GridEditableItem)e.Item;
                RadNumericTextBox nmc = (RadNumericTextBox)item["SalesLinePressure"].Controls[0];
                nmc.Width = Unit.Pixel(280);

  5. Ari Perlstein
    Ari Perlstein avatar
    6 posts
    Member since:
    Nov 2009

    Posted 15 May 2015 Link to this post

    This doesn't seem to work for batch editing.  I am on the latest version of the UI.
  6. Eyup
    Eyup avatar
    2942 posts

    Posted 20 May 2015 Link to this post

    Hello Ari,

    Essentially, Batch editing is a bit different from the other modes. It is mainly a client-side functionality and in this sense, it is a better idea to implement javascript approaches in this case. For example, there are not 10 different numeric textboxes generated to edit each of the records as with EditForms or PopUp edit modes, but there is only 1 numbox loaded on the server which works for ideal performance and rendering optimization when opening the edit cells on the client. In addition, creating custom edit templates with Batch editing mode may require further handling:
    (Section Handling Advanced Templates)

    With that being said,
    you can check the aforementioned article to see how to access the editors programmatically and apply the settings to the numeric textbox in the code-behind. Alternatively, you can access the numbox on the client and set its text upon some conditions met:

    Hope this helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft R3 2016 release webinar banner