Is it possible to set width of texte box when I edit a row in edit in place mode
Actually I create column dynamically like this :
Actually I create column dynamically like this :
For
Each col As GridColumnDefinition In Columns
Dim column As GridBoundColumn = New GridBoundColumn
column.HeaderStyle.Width = col.Width
column.ItemStyle.Width = col.Width - 5
column.HeaderText = col.HeaderText
column.DataField = col.Name
column.UniqueName = col.Name
Me.Grid.MasterTableView.Columns.Add(column)
MasterTableViewWidth += col.Width
Next
I try to set textbox width when i create column. Is it possible ?
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 12 Jun 2008, 07:21 AM
Hi,
Try to set the width of the TextBox in edit mode as shown below.
CS:
Thanks
Shinu.
Try to set the width of the TextBox in edit mode as shown below.
CS:
| protected void RadGrid1_ItemDataBound(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(50); |
| } |
| } |
Thanks
Shinu.
0
ericc34
Top achievements
Rank 1
answered on 12 Jun 2008, 11:53 AM
Thanks
I must specify ColumnUniqueName but my columns are dynamic and they are named Col1, Col2, etc... but I don't know how much column i have. Is it possible to do resize for each column ex : 95% of column width for each column
thanks
I must specify ColumnUniqueName but my columns are dynamic and they are named Col1, Col2, etc... but I don't know how much column i have. Is it possible to do resize for each column ex : 95% of column width for each column
thanks
0
Demon
Top achievements
Rank 1
answered on 12 Jun 2008, 12:06 PM
Eric,
You can also specify the textboxes' width using CSS only:
.GridEditRow_SkinName input
{
width: ..... ;
}
The width can be set in pixels or percent. The downside of this approach is that this CSS rule will influence any checkboxes and radio buttons, which exists in the edit row. This can be overcome with
.GridEditRow_SkinName input[type="text"]
{
width: ..... ;
}
However, this does not work in IE6.
You can also specify the textboxes' width using CSS only:
.GridEditRow_SkinName input
{
width: ..... ;
}
The width can be set in pixels or percent. The downside of this approach is that this CSS rule will influence any checkboxes and radio buttons, which exists in the edit row. This can be overcome with
.GridEditRow_SkinName input[type="text"]
{
width: ..... ;
}
However, this does not work in IE6.
0
Princy
Top achievements
Rank 2
answered on 12 Jun 2008, 12:08 PM
Hi,
You can also try the following code snippet in the PreRender event.
CS:
Thanks
Princy.
You can also try the following code snippet in the PreRender event.
CS:
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| foreach (GridEditableItem edititem in RadGrid1.MasterTableView.GetItems(GridItemType.EditItem)) |
| { |
| foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) |
| { |
| if (edititem.IsInEditMode) |
| { |
| TextBox txtbx = (TextBox)edititem[col.UniqueName].Controls[0]; |
| txtbx.Width = Unit.Pixel(50); |
| } |
| } |
| } |
| } |
Thanks
Princy.