skin file and gridview columns

Discussion in 'ASP .Net' started by Steve B., Jun 21, 2007.

  1. Steve B.

    Steve B. Guest

    Hi,

    I'd like to apply a css class on all cells in all gridviews in my app. To
    achieve that, I have to set hte item-style cssclass property of each
    columns.

    If I add this to my skin file :

    <asp:GridView
    runat="server"
    >

    <FooterStyle CssClass="GridViewFooterStyle" />
    <PagerStyle CssClass="GridViewPagerStyle" />
    <PagerSettings PageButtonCount="100" />
    <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
    <HeaderStyle CssClass="GridViewHeaderStyle" />
    <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
    <Columns>
    <asp:BoundField ItemStyle-CssClass="ItemStyle" />
    </Columns>
    </asp:GridView>

    All gridview in my apps have only one column (empty) with the style
    applied... It seems that when <Columns> is defined, it overrides all colums
    definition in all pages...

    Finally, the only way I found is to add the property to all columns in all
    gridview in all pages which requires a lot of extra work....

    Is there any way to reach my goal ?

    Thanks,
    Steve
    Steve B., Jun 21, 2007
    #1
    1. Advertising

  2. Steve B.

    Riki Guest

    Steve B. wrote:
    > Hi,
    >
    > I'd like to apply a css class on all cells in all gridviews in my
    > app. To achieve that, I have to set hte item-style cssclass property
    > of each columns.
    >
    > If I add this to my skin file :
    >
    > <asp:GridView
    > runat="server"
    >>

    > <FooterStyle CssClass="GridViewFooterStyle" />
    > <PagerStyle CssClass="GridViewPagerStyle" />
    > <PagerSettings PageButtonCount="100" />
    > <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
    > <HeaderStyle CssClass="GridViewHeaderStyle" />
    > <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
    > <Columns>
    > <asp:BoundField ItemStyle-CssClass="ItemStyle" />
    > </Columns>
    > </asp:GridView>
    >
    > All gridview in my apps have only one column (empty) with the style
    > applied... It seems that when <Columns> is defined, it overrides all
    > colums definition in all pages...
    >
    > Finally, the only way I found is to add the property to all columns
    > in all gridview in all pages which requires a lot of extra work....
    >
    > Is there any way to reach my goal ?
    >
    > Thanks,
    > Steve


    Use RowStyle on the GridView, and remove the <Colums> tag.

    By adding the <Columns> tag, you are telling to all gridviews in your
    applications to use this column defined in the skin. Obviously, that's
    not what you want.

    --

    Riki
    Riki, Jun 21, 2007
    #2
    1. Advertising

  3. Steve B.

    Steve B. Guest

    I don't want to target the row, but the cells.
    I actually want to define this style :

    ItemTemplate { border-top : solid black 2px;border-bottom : solid black
    px }

    If I apply this style to the row, it won't apply. I have to apply on the
    cell (in fact, on the TD tag, not the TR).

    Steve

    "Riki" <> wrote in message
    news:...
    > Steve B. wrote:
    >> Hi,
    >>
    >> I'd like to apply a css class on all cells in all gridviews in my
    >> app. To achieve that, I have to set hte item-style cssclass property
    >> of each columns.
    >>
    >> If I add this to my skin file :
    >>
    >> <asp:GridView
    >> runat="server"
    >>>

    >> <FooterStyle CssClass="GridViewFooterStyle" />
    >> <PagerStyle CssClass="GridViewPagerStyle" />
    >> <PagerSettings PageButtonCount="100" />
    >> <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
    >> <HeaderStyle CssClass="GridViewHeaderStyle" />
    >> <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
    >> <Columns>
    >> <asp:BoundField ItemStyle-CssClass="ItemStyle" />
    >> </Columns>
    >> </asp:GridView>
    >>
    >> All gridview in my apps have only one column (empty) with the style
    >> applied... It seems that when <Columns> is defined, it overrides all
    >> colums definition in all pages...
    >>
    >> Finally, the only way I found is to add the property to all columns
    >> in all gridview in all pages which requires a lot of extra work....
    >>
    >> Is there any way to reach my goal ?
    >>
    >> Thanks,
    >> Steve

    >
    > Use RowStyle on the GridView, and remove the <Colums> tag.
    >
    > By adding the <Columns> tag, you are telling to all gridviews in your
    > applications to use this column defined in the skin. Obviously, that's
    > not what you want.
    >
    > --
    >
    > Riki
    >
    Steve B., Jun 21, 2007
    #3
  4. Steve B.

    Riki Guest

    Steve B. wrote:
    > I don't want to target the row, but the cells.
    > I actually want to define this style :
    >
    > ItemTemplate { border-top : solid black 2px;border-bottom : solid
    > black px }
    >
    > If I apply this style to the row, it won't apply. I have to apply on
    > the cell (in fact, on the TD tag, not the TR).


    In that case, modify the css class into:
    ItemTemplate td { border-top : solid black 2px;border-bottom : solid black
    px }

    (note the addition of td after ItemTemplate).

    This will apply the style to every td inside the tr that is targeted.

    --

    Riki
    Riki, Jun 21, 2007
    #4
    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?QnVydA==?=
    Replies:
    1
    Views:
    984
    =?Utf-8?B?QnVydA==?=
    Apr 9, 2006
  2. Bishop
    Replies:
    0
    Views:
    564
    Bishop
    May 9, 2006
  3. Daves
    Replies:
    0
    Views:
    727
    Daves
    May 12, 2006
  4. Jacksm
    Replies:
    2
    Views:
    845
    Paul Chalekian
    Nov 21, 2006
  5. Vinki

    template columns and bound columns in gridview

    Vinki, Apr 25, 2007, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    855
    Vinki
    Apr 25, 2007
Loading...

Share This Page