asp.net.ph

DataList.GridLines Property

System.Web.UI.WebControls Namespace   DataList Class


Sets or retrieves the grid line style for a DataList control.

Syntax


Inline <asp:datalist gridlines = enumValue ... >
Script DataList.GridLines [ = enumValue ]

Property Value


enumValue One of the GridLines enum values.

The property is read/write with a default value of None.

Remarks

Use the GridLines property to specify whether the border between the cells of a DataList control is displayed. This property is set with one of the GridLines enumeration values.

NOTE: This property only applies if the RepeatLayout property is set to Table ( default ).

Example

The sample below shows how to programmatically set the GridLines property of a DataList at run time, depending on user input. The code also demonstrates how simple it is to retrieve the available system grid styles and dynamically add each to a selectable list.

void Page_Load ( Object src, EventArgs e ) {
   if ( !IsPostBack ) {
      ICollection grids = 
         TypeDescriptor.GetConverter ( typeof ( GridLines ) ).GetStandardValues ( );

      foreach ( GridLines g in grids ) {
         GridSelect.Items.Add ( g.ToString ( ) );
      }
      GridSelect.SelectedIndex = 2;

      string query = "SELECT ... FROM Employees";
      myGrid.DataSource = fetchData ( query, "northwind" );
      myGrid.DataBind ( );
   }
   myGrid.GridLines = ( GridLines ) GridSelect.SelectedIndex;
}
  C# VB

 Show me 

See Also

DataList Members   CellPadding   CellSpacing Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph