Using JQuery themeroller with ASP.NET gridview
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 t开发者_如何转开发ype of functionality?
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
}
}
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.
精彩评论