Note that there are some explanatory texts on larger screens.

plurals
  1. POApplying ItemStyle or HeaderStyle in GridView Skin
    primarykey
    data
    text
    <p>I would like to apply default column-based styles to my <code>GridView</code> controls using a skin or other function of ASP.NET themes (or really any other automated way).</p> <p>Currently my GridView skin looks like this:</p> <pre><code>&lt;asp:GridView runat="server" GridLines="None"&gt; &lt;HeaderStyle CssClass="GridViewRowHeader" /&gt; &lt;FooterStyle CssClass="GridViewRowHeader" /&gt; &lt;RowStyle CssClass="GridViewRowA" /&gt; &lt;AlternatingRowStyle CssClass="GridViewRowB" /&gt; &lt;/asp:GridView&gt; </code></pre> <p>And a typical GridView column definition looks like this:</p> <pre><code> &lt;Columns&gt; &lt;asp:BoundField DataField="ExitTimestamp" HeaderText="Exit" SortExpression="ExitTimestamp"&gt; &lt;ItemStyle CssClass="GridViewCell" /&gt; &lt;HeaderStyle CssClass="GridViewHeader" /&gt; &lt;/asp:BoundField&gt; &lt;asp:TemplateField HeaderText="Visitor Name/Agency"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("VisitorName") %&gt;'&gt;&lt;/asp:Label&gt;&lt;br /&gt; &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Bind("VisitorAgency") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;ItemStyle CssClass="GridViewCell" /&gt; &lt;HeaderStyle CssClass="GridViewHeader" /&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; </code></pre> <p>What I would like to get around is having to add the <code>&lt;ItemStyle&gt;</code> and <code>&lt;HeaderStyle&gt;</code> elements to every column definition in my <code>GridView</code> controls. I have tried various ways in the skin file including adding a <code>&lt;Columns&gt;</code> container and <code>&lt;ItemStyle&gt;</code> element therein, but nothing seems to work. Is there a way to do this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload