Welcome Guest Search | Active Topics | Sign In | Register

adding grid columns to grid Options
Scott
Posted: Saturday, January 5, 2008 5:29:22 AM
Rank: Newbie
Groups: Member

Joined: 10/13/2007
Posts: 8
I'm using the gid control and I am trying to add a column through code, but this example below will not add the column

even if I just do grid.columns.add() it will not add the column.

For i As Integer = 0 To dt.Columns.Count - 1
Dim Col As EO.Web.GridColumn
Col.DataType = EO.Web.GridColumnDataType.Auto
str = dt.Columns(i).ColumnName
Col.DataField = str
Col.HeaderText = str
Col.AllowSort = True
Grid.Columns.Add(Col)
Next

Error I get is Col is null and MustInherit Public Class

How can I add a column to an existing grid control through code?
eo_support
Posted: Saturday, January 5, 2008 6:38:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi Scott,

You will have to use New to create a GridColumn first. Without doing that, Col is Nothing. So of course you will get a "Col is Null" error. Also you need to decide which type of column you want to create (StaticColumn, DateTimeColumn, etc), you can not create the abstract GridColumn.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.