skin file and gridview columns

S

Steve B.

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
 
R

Riki

Steve said:
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.
 
S

Steve B.

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
 
R

Riki

Steve said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top