<html>
<head>
<title>FormView PagerSettings, PagerStyle Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<style type="text/css">
<!--
tr {
vertical-align:top}
.title {
font:bold 13pt; padding:5;
background:teal; color:ivory}
.empname {
font:bold 13pt; padding:5;
background:navy; color:khaki}
.notes {
background-color:ghostwhite;
padding:10; border:1px inset}
-->
</style>
<script language="C#" runat="server">
void setPager ( Object src, EventArgs e ) {
empsView.PagerSettings.Mode = ( chkNumbers.Checked ) ?
PagerButtons.Numeric : PagerButtons.NextPrevious;
empsView.PagerSettings.Position = ( chkTop.Checked ) ?
PagerPosition.Top : PagerPosition.Bottom;
empsView.PagerSettings.Visible = ( !chkHide.Checked );
empsView.DataBind ( );
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>FormView <span class="hilite">PagerSettings</span>, <span class="hilite">PagerStyle</span> Example</h2></div>
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<table cellpadding=5 width=70%>
<tr style="font-size:8pt">
<td align="right">
<asp:checkbox id="chkNumbers" runat="server"
title="Mode Property"
text="Numeric buttons"
autopostback
onCheckedChanged="setPager" />
<asp:checkbox id="chkTop" runat="server"
title="Position Property"
text="Pager on Top"
autopostback checked
onCheckedChanged="setPager" />
<asp:checkbox id="chkHide" runat="server"
title="Visibility Property"
text="Hide Pager"
autopostback
onCheckedChanged="setPager" />
</td></tr>
</table>
<asp:formview id="empsView" runat="server"
datasourceid="emps"
width=70% cellpadding=5
allowpaging>
<pagersettings
mode="nextprevious"
nextpagetext="Next" previouspagetext="Back"
position="top"
pagebuttoncount=10 />
<pagerstyle
backcolor="steelblue" forecolor="beige"
horizontalalign="right" />
<itemtemplate>
<table cellpadding=10 width="100%" align="center" bgcolor="whitesmoke">
<tr>
<td>
<img align="top" runat="server" border=0
src='<%# Eval ( "photopath", "~/shared/images/{0}" ) %>' />
</td>
<td>
<table cellpadding=5>
<tr>
<td colspan=2><div class="empname" runat="server">
<%# Eval ( "firstname" ) %>
<%# Eval ( "lastname" ) %>
</div></td>
</tr>
<tr>
<td>
<b>Title:</b> <%# Eval ( "title" ) %><br>
<b>Hire Date:</b> <%# Eval ( "hiredate", "{0:d}" ) %><br>
<b>Extension:</b> <%# Eval ( "extension" ) %></td>
</tr>
<tr>
<td>
<div class="notes">
<%# Eval ( "notes" ) %>
</div>
</td>
</tr>
</table>
</td></tr>
</table>
</itemtemplate>
</asp:formview>
<asp:sqldatasource id="emps" runat="server"
connectionstring="<%$ ConnectionStrings:aspnet %>"
selectcommand="SELECT * FROM employees" />
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>