please remove this post if someone else had already posted it in this forum. OR, if you think my post is not best practice/recomended. I was looking for an easy way to adjust my textboxes width in an automatic edit generated form. While I found answers that requires little more work, I was able to figure out an easier way to acheive that without writing to much code. I hope that this code will help others who are/were in the same situation like me.
************
Imports
Telerik.Web.UI
....
Private Sub GridUnits_CreateColumnEditor(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCreateColumnEditorEventArgs) Handles GridUnits.CreateColumnEditor
If IsNumeric(Right(e.Column.UniqueName, 3)) Then
Dim tbwidth As Integer
tbwidth =
CType(Right(e.Column.UniqueName, 3), Integer)
Dim tbGeneric = DirectCast(e.ColumnEditor, GridTextBoxColumnEditor)
tbGeneric.TextBoxControl.Width = Unit.Pixel(tbwidth)
End If
End Sub
All you have to do is to add three digit number to each uniquename property for the columns you wish to overwrite its width
<telerik:GridBoundColumn DataField="TabNo" DataType="System.Int32" HeaderText="TabNo"
SortExpression="TabNo" UniqueName="TabNo" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Icon_url" HeaderText="Icon_url" SortExpression="Icon_url"
UniqueName="Icon_url300" Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="bgImage_url" HeaderText="bgImage_url" SortExpression="bgImage_url"
UniqueName="bgImage_url200" Visible="False">
</telerik:GridBoundColumn>
If you know of an easier way, please let me know