Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > skin file and gridview columns

Reply
Thread Tools

skin file and gridview columns

 
 
Steve B.
Guest
Posts: n/a
 
      06-21-2007
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


 
Reply With Quote
 
 
 
 
Riki
Guest
Posts: n/a
 
      06-21-2007
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


 
Reply With Quote
 
 
 
 
Steve B.
Guest
Posts: n/a
 
      06-21-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Riki
Guest
Posts: n/a
 
      06-21-2007
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
template columns and bound columns in gridview Vinki ASP .Net Web Controls 2 04-25-2007 04:22 PM
Align table columns with gridview columns Jacksm ASP .Net 2 11-21-2006 09:49 PM
gridview skin, set cssclass for hyperlinks Daves ASP .Net 0 05-12-2006 07:02 AM
Skin an Image in Gridview Template Column? Bishop ASP .Net 0 05-09-2006 04:46 PM
Can't set Theme skin Font-Size for GridView CommandField ButtonTyp =?Utf-8?B?QnVydA==?= ASP .Net 1 04-09-2006 10:39 PM



Advertisments