0

For those of us who are aesthetically challenged, is there a way to apply JQuery's themes (e.g. redmond) to an ASP.NET gridview?

Something like ...

$(document).ready(function() { $(function() { $("<%= MyGridView.ClientID %>").Table(); }); });

Perhaps there's an addin that would emulate that type of functionality?

James Evans
  • 179
  • 1
  • 1
  • 8
  • Did u get it working? Can you please answer http://stackoverflow.com/questions/9174678/using-jquery-ui-themes-with-asp-net-controls ? – LCJ Feb 08 '12 at 06:35

2 Answers2

0

Just give your gridview a css class and use that in the jquery selector. That way you can have a standard javascript file in all your pages and all you have to do is add the relevent css class to a gridview and it will be styled.

Ben Robinson
  • 20,984
  • 5
  • 58
  • 76
  • I had tried that but did see any difference. Is there a table-oriented class in any of the themes? – James Evans May 11 '10 at 15:13
  • http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs/ Here are a couple table css examples that will work with the gridview – Jordan Johnson May 12 '10 at 18:29
0

The gridview html renders to a table. If you add css class to it then you will be fine. Also, add the following in the gridview Databound event so the header does not render as a row.

protected void gridView_DataBound(object sender, EventArgs e)
    {
        if (gridView.Rows.Count > 0)
        {

            gridView.UseAccessibleHeader = true;

            gridView.HeaderRow.TableSection = TableRowSection.TableHeader;
            gridView.HeaderRow.CssClass = ///--Optional--
            gridView.FooterRow.TableSection = TableRowSection.TableFooter;
            gridView.PagerSettings.Visible = true; ///Helps footer
        }
    }
Jordan Johnson
  • 253
  • 1
  • 4
  • 16
  • Can you please answer http://stackoverflow.com/questions/9174678/using-jquery-ui-themes-with-asp-net-controls ? – LCJ Feb 08 '12 at 04:46