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

Control width in grid, when in batch edit mode

1 Answer 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jacek
Top achievements
Rank 1
Jacek asked on 17 Oct 2014, 01:32 PM
How can I set width of textbox, dropdown in edit mode while batch editing?
This code is not working :
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
            {
                GridEditFormItem editItem = (GridEditFormItem)e.Item;
                TextBox txtbx = (TextBox)editItem["LVL"].Controls[0];
                txtbx.Width = Unit.Pixel(20);
            }
        }
I dont want to have half of textbox visible, example in attachment.


1 Answer, 1 is accepted

Sort by
0
Jacek
Top achievements
Rank 1
answered on 17 Oct 2014, 01:51 PM
I have solution :
        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            TextBox x = (RadGrid1.MasterTableView.GetBatchColumnEditor("LVL") as GridTextBoxColumnEditor).TextBoxControl;
            x.Width = Unit.Pixel(20);
        }
Tags
Grid
Asked by
Jacek
Top achievements
Rank 1
Answers by
Jacek
Top achievements
Rank 1
Share this question
or