How do I set ButtonField style from theme file?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using ASP.Net 2.0 themes, and have a GridView with a ButtonField column.
I can not find a way to create a style for ButtonField columns in the
application's theme, specifically, I want to set the ControlStyle-Font-Size
property. Is there a way to do this, or would I have to set the style in
every place that I use a ButtonField column?
 
Howdy,

Because ButtonField is not actually a control, it only provides information
necessary to generate and render a column in gridview. Therefore you cannot
use Skin/Theme feature. As a work around i would suggest TemplateField:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink runat="server" ID="link" SkinID="Red"
Text="Click me!" NavigateUrl="#" CommandName="Select"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

-- and the skin file --
<asp:HyperLink runat="server" ForeColor="Red" SkinID="Red"/>
 
Back
Top