problems with datagrid

L

luna

getting frustrated - cant seem to find the info i need to complete im just
going round in circles
(most things ive read are inline code....)

im using asp.net with vb codebehind - im trying to format the columns in
codebehind
with this code

Dim strConn As String = "usual connection string stuff"
Dim conn As New System.Data.SqlClient.SqlConnection(strConn)
Dim sql As String = "select * from diary"
'Dim da As New System.Data.SqlClient.SqlCommand(sql, conn)
Dim da As New System.Data.sqlclient.SqlDataAdapter(sql, conn)
Dim ds As New DataSet
da.Fill(ds)
DataGrid1.DataSource = ds
DataGrid1.DataBind()
conn.Open()

i need to format the columns somehow
in vb i know its something like

Dim ts As New DataGridTableStyle()
ts.MappingName = "Table"
DataGrid1.TableStyles.Clear()
DataGrid1.TableStyles.Add(ts)
Me.DataGrid1.DataSource = ds.Tables(0)
ts.GridColumnStyles(0).Width = 110
ts.GridColumnStyles(1).Width = 90
ts.GridColumnStyles(2).Width = 100
ts.GridColumnStyles(3).Width = 90
ts.GridColumnStyles(4).Width = 250

not sure what the equivalent is
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Datagrid Formatting 1
Set DataSource 0
datagrid bidirectional sorting 4
NEWBIE & datagrid 2
DataSource 4
Datagrid problems 0
Datagrid PageIndexChanged event doesn't fire 1
DataGrid Issue 0

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top