Changing Headers on DataGrid

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

  1. Gary

    Gary Guest

    I have not had my previous posts answered and I really
    need to fix this problem. Please help.

    I have populated a datagrid in code but I would like to
    change the header text and width of two of the columns.

    I used the following code after binding the dataset to
    the grid:

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

    I did this twice. Then I added the GridColumnStyles and
    finally did a TableStyles.Add.

    When the grid displays the data, no columns appear. What
    am I doing wrong?

    Thanks,

    Gary
    Gary, Apr 2, 2004
    #1
    1. Advertising

  2. DataGrid.Columns[0].HeaderText = "bla-bla";
    DataGrid.Columns[0].ItemStyle.Width = 1500;

    Remember! You have to do it before databind of datagrid.

    "Gary" <> wrote in message
    news:1759201c418c2$e54cbc70$...
    > I have not had my previous posts answered and I really
    > need to fix this problem. Please help.
    >
    > I have populated a datagrid in code but I would like to
    > change the header text and width of two of the columns.
    >
    > I used the following code after binding the dataset to
    > the grid:
    >
    > Dim cstStartTime As New DataGridTextBoxColumn
    > cstStartTime.MappingName = "StartTime"
    > cstStartTime.HeaderText = "Start Time"
    > cstStartTime.Width = 1550
    >
    > I did this twice. Then I added the GridColumnStyles and
    > finally did a TableStyles.Add.
    >
    > When the grid displays the data, no columns appear. What
    > am I doing wrong?
    >
    > Thanks,
    >
    > Gary
    >
    Michael Tkachev, Apr 7, 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. =?Utf-8?B?SnVzdGluUw==?=

    Changing Request Headers values

    =?Utf-8?B?SnVzdGluUw==?=, Aug 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    460
    Andy Fish
    Aug 16, 2005
  2. dont bother
    Replies:
    0
    Views:
    773
    dont bother
    Mar 3, 2004
  3. Replies:
    2
    Views:
    2,232
  4. Phil
    Replies:
    4
    Views:
    663
    Gabriel Genellina
    Jan 17, 2010
  5. Ian
    Replies:
    2
    Views:
    1,914
Loading...

Share This Page