Modifying Columns in Datagrid

Discussion in 'ASP .Net Datagrid Control' started by Gary, Apr 1, 2004.

  1. Gary

    Gary Guest

    I want to change the layout of columns in a datagrid. I
    want to change the heading and the width of columns. In
    the Load Event on the form, I have the following code:

    Dim tsNotes As New DataGridTableStyle
    tsNotes.MappingName = "Notes"

    Dim cstDate As New DataGridTextBoxColumn
    cstDate.MappingName = "NoteDate"
    cstDate.HeaderText = "Note Date"
    cstDate.Width = 1650

    Dim cstStartTime As New DataGridTextBoxColumn
    cstStartTime.MappingName = "StartTime"
    cstStartTime.HeaderText = "Start Time"
    cstStartTime.Width = 1550

    Dim cstEndTime As New DataGridTextBoxColumn
    cstEndTime.MappingName = "EndTime"
    cstEndTime.HeaderText = "End Time"
    cstEndTime.Width = 1550

    tsNotes.GridColumnStyles.Add(cstDate)
    tsNotes.GridColumnStyles.Add(cstStartTime)
    tsNotes.GridColumnStyles.Add(cstEndTime)

    Me.DG_Notes.TableStyles.Add(tsNotes)

    But when I run this code, I can see no columns at all.
    If I change themapping name from "Notes" to "PNotes",
    these styles do not get applied. If I leave it
    at "Notes" I can't see any columns. What am I doing
    wrong?

    Any help would be appreciated.

    Thanks in advance,

    Gary
     
    Gary, Apr 1, 2004
    #1
    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. helpful sql
    Replies:
    0
    Views:
    820
    helpful sql
    May 19, 2005
  2. Replies:
    5
    Views:
    601
  3. Replies:
    4
    Views:
    941
  4. rob thomson
    Replies:
    0
    Views:
    266
    rob thomson
    Sep 4, 2003
  5. ton
    Replies:
    2
    Views:
    207
    Alvin Bruney [MVP]
    Feb 11, 2004
Loading...

Share This Page