<%@ Import namespace="System.ComponentModel" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<head>
<title>DataGrid GridLines Property</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server" src="fetchData_sql.cs" />
<script language="C#" runat="server">
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 Lastname, Firstname, Address, City, Country FROM Employees";
myGrid.DataSource = fetchData ( query );
myGrid.DataBind ( );
}
myGrid.GridLines = ( GridLines ) GridSelect.SelectedIndex;
}
</script>
</head>
<body>
<div class="header"><h2>DataGrid GridLines Property</h2></div>
<hr size=1 width=92%>
<div align="center">
<h4><i>GridLines</i> specifies the grid line styles for controls displaying items in a table structure, such as the DataGrid.</h4>
<form runat="server">
<p>Select gridlines <asp:dropdownlist id="GridSelect"
autopostback runat="server" /></p>
<asp:datagrid id="myGrid" runat="server"
width="92%"
cellpadding=5
font-size="10pt"
headerstyle-backcolor="lightsteelblue"
headerstyle-font-bold
backcolor="ghostwhite" />
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>