DataGridTableStyle question

lauriemc

Freshman
Joined
Feb 2, 2007
Messages
26
I am in the process of re-writing a vb.net windows application into a vb.net web application. I have a problem.

In the vb.net windows app I used the DataGridTableStyle to successfully format a grid (datagrid) within code. The code looked something like this:

Dim dgts1 As New DataGridTableStyle
With dgts1
.MappingName = sptable
End With

Dim grdColumn1 As New DataGridTextBoxColumn
With grdColumn1
.MappingName = "Unit_Number" ' mapping to SQL Server column name
.HeaderText = "Unit"
.Width = 45
End With
dgts1.GridColumnStyles.Add(grdColumn1)

And so on......

but in the web development environment, it is not recognizing the DataGridTableStyle. So my question is, what can I use in place of it, so that I can format my 'gridview' in code.

Thank you,
lauriemc
 
Are you using the DataGrid or the GridView?

My memory is fuzzy on DataGrid, but GridView [which is very much the same only better] works like this:

Code:
<ItemStyle-Width="45" />

Use that inside your item templates.

I'm sure you can access the properties from CodeBehind -- check the intelisense on your gridview item. (I'd use the OnRowDataBinding Event).
 
Back
Top