Thursday, September 18, 2008

Resize the textbox of Gridview in EditMode

Protected Sub GridView2_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowCreated

Dim r As Integer
Dim q As Integer = 0
For q = 0 To GridView2.Rows.Count - 1
For r = 0 to 10
If GridView2.Rows(q).Cells(r).Controls.Count > 0 Then
CType(GridView2.Rows(q).Cells(r).Controls(0), TextBox).Width = Unit.Pixel(52)
End If
Next
Next
End Sub