Please answer <<<<<<<<<<<<<<<<<<

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

  1. Gary

    Gary Guest

    Nobody answered my previous post from last night. I
    would really like to get this solved. Is is puzzling.

    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 3, 2004
    #1
    1. Advertising

  2. One other approach is to trap the itemcreated or itemdatabound event handler
    and adjust the column attributes there

    e.item.cells[2].width = 10 roughly

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/27cok
    "Gary" <> wrote in message
    news:14cbe01c41906$59450450$...
    > Nobody answered my previous post from last night. I
    > would really like to get this solved. Is is puzzling.
    >
    > 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
    >
    > .
    >
    >
     
    Alvin Bruney [MVP], Apr 4, 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. KathyB
    Replies:
    0
    Views:
    573
    KathyB
    Jul 25, 2003
  2. Robocop
    Replies:
    2
    Views:
    445
    Andrew Hobbs
    Feb 22, 2004
  3. Replies:
    7
    Views:
    433
    Roedy Green
    Oct 25, 2005
  4. KK
    Replies:
    2
    Views:
    597
    Big Brian
    Oct 14, 2003
  5. Ray
    Replies:
    12
    Views:
    505
    Adrian Holovaty
    Jan 13, 2006
Loading...

Share This Page