How to change input size when editing?

2 posts, 0 answers
  1. King Wilder
    King Wilder avatar
    240 posts
    Member since:
    Oct 2007

    Posted 22 Jul 2008 Link to this post

    I can't find a way of changing the size of the input field that appears when the Edit or Insert command is clicked.

    I tried changing the ItemStyle-Width property, but that just changes the size of the column, not the input control in edit mode.

    Does anyone know how to do this?

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

    Posted 23 Jul 2008 Link to this post


    Try out the following code snippet to change the width of the textboxes in Edit/Insert mode.

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
           //In Edit Mode 
            if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
                GridEditableItem item1=(GridEditableItem)e.Item; 
                TextBox txtbx1 = (TextBox)item1["ProductName"].Controls[0]; 
                txtbx1.Width = 100
           //In Insert Mode 
            if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) 
                GridEditFormInsertItem item2 = (GridEditFormInsertItem)e.Item; 
                TextBox txtbx2 = (TextBox)item2["ProductName"].Controls[0]; 
                txtbx2.Width = 50

Back to Top