<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<title>DataGrid ShowHeader Property</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server" src="fetchData_oledb.cs" />
<script language="C#" runat="server">
void Page_Load ( Object src, EventArgs e ) {
if ( !IsPostBack ) {
string query = "SELECT * FROM SalesByEmployee";
myGrid.DataSource = fetchData ( query, "dbtutor" );
myGrid.DataBind ( );
}
}
void ShowHide ( Object src, EventArgs E ) {
myGrid.ShowHeader = myGrid.ShowHeader ? false : true;
myButton.Text = myGrid.ShowHeader ? "Hide header" : "Show header";
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>DataGrid ShowHeader Property</h2></div>
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<asp:button id="myButton" runat="server"
text="Hide header"
font-bold=true
backcolor="navy"
forecolor="gold"
onClick="ShowHide" />
<p>
<asp:datagrid id="myGrid" runat="server"
cellpadding=5>
<headerstyle
backcolor="maroon"
forecolor="khaki"
font-bold
font-italic />
</asp:datagrid>
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>