HeaderStyle - How to align differently then rest of gird

Discussion in 'ASP .Net Web Controls' started by RGB, Jan 7, 2005.

  1. RGB

    RGB Guest

    I am creating a datagrid. I need for the header to align closer to the
    bottom of the grid row then then the rest of the data in the grid. I have
    tried using HeaderStyle and putting a style of padding-bottom, setting it to
    a negative number, but that doesn't seem to have an affect on the look. The
    padding for the grid itself is 4px, but I need the header to have NO padding.

    Any ideas?

    Here is the code (keep in mind it is using style sheets where I am changing
    the padding-bottom to no avail!):

    <asp:DataGrid Width="100%" id="companyGrid" runat="server"
    AutoGenerateColumns="False" CssClass="reporttype highlight" GridLines="None"
    style="MARGIN-BOTTOM: 0px">
    <AlternatingItemStyle CssClass="greyBkg"></AlternatingItemStyle>
    <HeaderStyle CssClass="reporttypeheader"></HeaderStyle>
    <Columns>
    <cc:RowSelectorColumn HeaderText="COMPANY NAME" SelectionMode="Single">
    <ItemStyle Width="40px" CssClass="leftcolumn"></ItemStyle>
    </cc:RowSelectorColumn>
    <asp:BoundColumn DataField="CompanyName"></asp:BoundColumn>
    <asp:BoundColumn Visible="False" DataField="CompanyGUID"></asp:BoundColumn>
    </Columns>
    </asp:DataGrid>
     
    RGB, Jan 7, 2005
    #1
    1. Advertising

  2. "RGB" <> wrote in message
    news:...
    >I am creating a datagrid. I need for the header to align closer to the
    > bottom of the grid row then then the rest of the data in the grid. I have
    > tried using HeaderStyle and putting a style of padding-bottom, setting it
    > to
    > a negative number, but that doesn't seem to have an affect on the look.
    > The
    > padding for the grid itself is 4px, but I need the header to have NO
    > padding.
    >
    > Any ideas?
    >
    > Here is the code (keep in mind it is using style sheets where I am
    > changing
    > the padding-bottom to no avail!):


    If you add bottom padding does the alignment get worse? Try adding something
    silly like 20px and see what happens.

    John Saunders
     
    John Saunders, Jan 7, 2005
    #2
    1. Advertising

  3. RGB

    RGB Guest

    I actually have already done that. First I wanted to make sure it was using
    the style that I thought it was, so I made the font ridiculously large. Then
    I made the padding ridiculously large as well and the right and left padding
    worked, but not the bottom or top. I used "padding:" and set the top, right,
    bottom, left. I also used "padding-bottom" and that didn't work either, but
    that doesn't work for right or left either.

    "John Saunders" wrote:

    > "RGB" <> wrote in message
    > news:...
    > >I am creating a datagrid. I need for the header to align closer to the
    > > bottom of the grid row then then the rest of the data in the grid. I have
    > > tried using HeaderStyle and putting a style of padding-bottom, setting it
    > > to
    > > a negative number, but that doesn't seem to have an affect on the look.
    > > The
    > > padding for the grid itself is 4px, but I need the header to have NO
    > > padding.
    > >
    > > Any ideas?
    > >
    > > Here is the code (keep in mind it is using style sheets where I am
    > > changing
    > > the padding-bottom to no avail!):

    >
    > If you add bottom padding does the alignment get worse? Try adding something
    > silly like 20px and see what happens.
    >
    > John Saunders
    >
    >
    >
     
    RGB, Jan 7, 2005
    #3
  4. "RGB" <> wrote in message
    news:...
    >I actually have already done that. First I wanted to make sure it was
    >using
    > the style that I thought it was, so I made the font ridiculously large.
    > Then
    > I made the padding ridiculously large as well and the right and left
    > padding
    > worked, but not the bottom or top. I used "padding:" and set the top,
    > right,
    > bottom, left. I also used "padding-bottom" and that didn't work either,
    > but
    > that doesn't work for right or left either.


    I don't know. I'm not an HTML expert. I'd play with margin and with
    cellpadding and cellspacing as well. In fact, I'd experiment on this on a
    normal <table> until I got it right, then I'd go apply it to the DataGrid.

    John Saunders
     
    John Saunders, Jan 7, 2005
    #4
  5. RGB

    RGB Guest

    The style works fine outside of the datagrid. I can get the bottom padding
    to change for the entire grid, but can't get only the heading to change it's
    padding.

    "John Saunders" wrote:

    > "RGB" <> wrote in message
    > news:...
    > >I actually have already done that. First I wanted to make sure it was
    > >using
    > > the style that I thought it was, so I made the font ridiculously large.
    > > Then
    > > I made the padding ridiculously large as well and the right and left
    > > padding
    > > worked, but not the bottom or top. I used "padding:" and set the top,
    > > right,
    > > bottom, left. I also used "padding-bottom" and that didn't work either,
    > > but
    > > that doesn't work for right or left either.

    >
    > I don't know. I'm not an HTML expert. I'd play with margin and with
    > cellpadding and cellspacing as well. In fact, I'd experiment on this on a
    > normal <table> until I got it right, then I'd go apply it to the DataGrid.
    >
    > John Saunders
    >
    >
    >
     
    RGB, Jan 7, 2005
    #5
  6. "RGB" <> wrote in message
    news:...
    > The style works fine outside of the datagrid. I can get the bottom
    > padding
    > to change for the entire grid, but can't get only the heading to change
    > it's
    > padding.


    When you say that it works outside of the grid, do you mean that it works in
    a table?

    Have you looked at the HTML generated by the DataGrid for a clue? In
    particular, can you get the style to work on a table similar to the one that
    the DataGrid generates?

    John Saunders
     
    John Saunders, Jan 7, 2005
    #6
    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. Kay
    Replies:
    2
    Views:
    7,189
  2. aleko
    Replies:
    0
    Views:
    325
    aleko
    Feb 25, 2005
  3. tshad

    text-align vs align

    tshad, Jun 23, 2005, in forum: HTML
    Replies:
    1
    Views:
    1,278
    David Dorward
    Jun 23, 2005
  4. news.microsoft.com

    hiding columns in gird based on column values

    news.microsoft.com, Oct 25, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    344
    Mark Rae [MVP]
    Oct 25, 2007
  5. Replies:
    0
    Views:
    312
Loading...

Share This Page