Intersoft WebGrid Documentation
WebGridFormatStyle Class
Members  Example  See Also  Send Feedback
ISNet.WebUI.WebGrid Namespace : WebGridFormatStyle Class






The class that handles properties and methods directly related to the appearance of an object inside the grid. WebGridFormatStyles are applied to the cells, footers and column headers of the grid.

Object Model

WebGridFormatStyle Class

Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class WebGridFormatStyle 
   Inherits ISNet.WebUI.WebStyle
   Implements ISNet.ICopyable, ISNet.IEmpty, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.IXmlLayoutSerialize 
Visual Basic (Usage)Copy Code
Dim instance As WebGridFormatStyle
C# 
[SerializableAttribute()]
public class WebGridFormatStyle : ISNet.WebUI.WebStyle, ISNet.ICopyable, ISNet.IEmpty, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.IXmlLayoutSerialize  
Delphi 
public class WebGridFormatStyle = class(ISNet.WebUI.WebStyle, ISNet.ICopyable, ISNet.IEmpty, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.IXmlLayoutSerialize)
JScript 
SerializableAttribute()
public class WebGridFormatStyle extends ISNet.WebUI.WebStyle implements ISNet.ICopyable, ISNet.IEmpty, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.IXmlLayoutSerialize 
Managed Extensions for C++ 
[SerializableAttribute()]
public __gc class WebGridFormatStyle : public ISNet.WebUI.WebStyle, ISNet.ICopyable, ISNet.IEmpty, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.IXmlLayoutSerialize  
C++/CLI 
[SerializableAttribute()]
public ref class WebGridFormatStyle : public ISNet.WebUI.WebStyle, ISNet.ICopyable, ISNet.IEmpty, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.IXmlLayoutSerialize  

Example

C#Copy Code
// This setting affects all WebGrid's hierarchy including all tables and columns to allow sorting.
LayoutSettings.AllowSorting = "Yes"

Remarks

WebGridFormatStyle implements the object that allow you to completely customize its appearance, look, and behavior. It contains numerous appearance-related such as BackColor, Font, BorderColor and so on; and is implemented by all UI elements such as Rows, Cells. The WebGridFormatStyle also allows you to put custom CSS Rules with the CustomRules property.

These are some features in WebGridFormatStyle to customize the style and appearance of WebGrid:

  • AlternatingRowStyle: To get or set the style that is used to display alternate row.
  • ButtonStyle: The style of button object of Button Column.
  • CheckedRowStyle: The style is applied to checked row.
  • FocusCellStyle : To get or set the style used when a row or cell is focused/selected.
  • FrameStyle : To specify the style applied to main WebGrid's frame.
  • GroupRowInfoStyle : To get or set the style for GroupRow.
  • HeaderStyle : The style is applied to the column headers.
  • PreviewRowStyle : The style is applied to preview row area.
  • RowHeaderStyle : The style is applied to row's header.
  • RowStyle : The style is used to display WebGridRow object.
  • SelectedRowStyle : The style is used to highlight selected row or cell.
  • SortedColumnStyle : The style is applied to the cell which column is sorted.
  • StatusBarCommandStyle: The normal, hover and active style for the command item in status bar.
  • StatusBarStyle: The style is applied to the status bar.

All of the styles above are accessible through LayoutSettings property, the centralized repository for all appearance and behavior-related settings. Most of element's styles support property inheritance, in which higher-level object's settings will override all lower-level object's settings which has "default" setting.

The WebGridFormatStyle itself contains numerous appearance-related settings including:

  • BackColor.
  • BackgroundImage.
  • BorderWidth, BorderColor, BorderSize.
  • CustomRules.
  • CssClass.
  • Cursor.
  • Font.
  • ForeColor.
  • Padding, Margin.
  • Height, Width. Note that these properties are not applicable to some UI elements such as CellStyle because those element's height and width are automatically calculated based on Row's height and Column's width to deliver consistent layout.
  • Horizontal Align, Vertical Align.
  • Wrap.

 

Developers generally have 2 considerations while customizing the styles of WebGrid:

  • Direct styles customization. This can be done through WebGrid.NET Designer and directly changing the styles in LayoutSettings or individual objects such as Table or Column. You can also apply a predefined layout from Layout Manager .
  • StyleSheet-controlled styles. It allows you to create a set of styles defined in external StyleSheet and have it linked to the WebGrid. It also enables the web applications to have global theme support for overall WebSite appearance. To use the styles that defined in-line or in external StyleSheet, simply set the CssClass of each element's style. When render, the WebGrid will automatically be displayed using the specified CssClass and correspond to defined styles.

 

In WebGrid.NET Enterprise 5.0 when users enable DefaultStyleMode, WebGrid will include a link to external stylesheet that contains reusable style definition used by the Default Style. This external resource is fetched by using standard WebResource feature, and is automatically handled by WebGrid. There is no efforts required by developers. However, if you enable DefaultStyleMode, all styles definition in the control instance should be removed. You can not have styles definition and using default style at the same time.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.UI.WebControls.Style
            ISNet.WebUI.WebStyle
               ISNet.WebUI.WebGrid.WebGridFormatStyle

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Reference

WebGridFormatStyle Members
ISNet.WebUI.WebGrid Namespace

Tasks

How-to: Control WebGrid's styles using external CSS definition
How-to: Enable Default Style for existing instance of WebGrid

Concepts

Rich Styles

©2012 Intersoft Solutions Corp. All Rights Reserved.