1
protected void GvAddWork_PreRender(object sender, EventArgs e)
2
{
3
if (GvAddWork.EditIndex > -1)
4
{
5
int intLength = 0;
6
for (int i = 1; i < GvAddWork.Rows[GvAddWork.EditIndex].Cells.Count - 3; i++)
7
{
8
TextBox TXTb = new TextBox();
9
TXTb = (TextBox)GvAddWork.Rows[GvAddWork.EditIndex].Cells[i].Controls[0];
10
intLength = TXTb.Text.Length;
11
intLength = intLength * 7;
12
if (intLength < 50)
13
intLength = 50;
14
TXTb.Width = intLength;
15
}
16
}
17
}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

1
Private Sub DataGrid1_PreRender(s As Object, e As EventArgs)
2
If DataGrid1.EditItemIndex > -1 Then
3
Dim tbx As TextBox
4
tbx = CType(DataGrid1.Items(DataGrid1.EditItemIndex).Cells(0).Controls(0), TextBox)
5
tbx.Width = Unit.Parse("1cm")
6
End If
7
End Sub

2

3

4

5

6

7
