problems with datagrid

Discussion in 'ASP .Net Datagrid Control' started by luna, Feb 18, 2004.

  1. luna

    luna Guest

    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
     
    luna, Feb 18, 2004
    #1
    1. Advertising

  2. Your post went unanswered. Have you resolved this issue?

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "luna" <> wrote in message
    news:UZGYb.2374$...
    > 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
    >
    >
     
    Alvin Bruney [MVP], Mar 2, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ingeborg

    DataGrid problems

    Ingeborg, Jun 28, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    439
    Luke Zhang [MSFT]
    Jul 1, 2003
  2. Susan Baker
    Replies:
    2
    Views:
    817
    kelvSYC
    Jun 26, 2005
  3. Shelly

    Problems, problems for newbie

    Shelly, Sep 2, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    2,188
    Shelly
    Sep 3, 2007
  4. Andreas Klemt
    Replies:
    0
    Views:
    310
    Andreas Klemt
    Oct 8, 2003
  5. Sak Na rede
    Replies:
    0
    Views:
    421
    Sak Na rede
    Jan 30, 2009
Loading...

Share This Page