Click here to Skip to main content
15,891,473 members
Articles / Web Development / ASP.NET

GridThemes

Rate me:
Please Sign up or sign in to vote.
4.92/5 (51 votes)
4 Mar 2007CPOL10 min read 168.6K   1.5K   161  
Combining a BuildProvider and IExtenderProvider to create a declarative framework for conditional formatting in ASP.NET GridViews.
<%@ Page Language="C#" MasterPageFile="~/SampleGridThemes.master" Title="GridThemes Demo" %>

<%@ Register Assembly="GridThemes" Namespace="UNLV.IAP.GridThemes" TagPrefix="cc1" %>

<script runat="server">
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
To use GridThemes, configure your application by performing the following steps:
<ol>
    <li>
        Copy the file <i>GridThemes.dll</i> to your project�s bin directory.
    </li>
    
    <li>
        Activate the build provider by adding the following entry to the <code>&lt;buildProviders&gt;</code> section of your web.config file:
<pre>&lt;system.web&gt;
  &lt;compilation debug="false"&gt;
      
    &lt;buildProviders&gt;
      &lt;add extension=".gt" 
           type="UNLV.IAP.GridThemes.GridThemesBuildProvider, GridThemes"/&gt;
    &lt;/buildProviders&gt;

  &lt;/compilation&gt;
&lt;/system.web&gt;
</pre>       
This associates the GridThemes custom builder with any files in the App_Code folder with .gt extensions.  You may substitute a different extension if you wish.
    </li>
    <li>
        Create and store conditional GridTheme files in the App_Code folder.  Examples of the 
        XML syntax used for GridTheme files are shown throughout this demo application.
    </li>
    <li>
    Add a <code>GridThemeExtender</code> control to your GridView�s .aspx page.
    </li>
    <li>
    Assign the desired theme name to the GridView�s newly extended <code>GridTheme</code> property.
    </li>
</ol>


</asp:Content>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
University of Nevada, Las Vegas
United States United States
With a background in education, music, application development, institutional research, data governance, and business intelligence, I work for the University of Nevada, Las Vegas helping to derive useful information from institutional data. It's an old picture, but one of my favorites.

Comments and Discussions