<html>
<head>
<title>DetailsView PagerSettings, PagerStyle Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void setPager ( Object src, EventArgs e ) {
planDetails.PagerSettings.Mode = ( chkNumbers.Checked ) ?
PagerButtons.Numeric : PagerButtons.NextPrevious;
planDetails.PagerSettings.Position = ( chkTop.Checked ) ?
PagerPosition.Top : PagerPosition.Bottom;
planDetails.PagerSettings.Visible = ( !chkHide.Checked );
planDetails.DataBind ( );
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>DetailsView <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=80%>
<tr style="font-size:10pt">
<td><b>Plan Type</b> <asp:dropdownlist id="typesSelect" runat="server"
datasourceid="planTypes" datatextfield="Type" autopostback /></td>
<td><b><asp:label id="lblTracker" runat="server" /></b></td>
<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:detailsview id="planDetails" runat="server"
datasourceid="plans"
width=80% cellpadding=5
font-size="10pt"
gridlines="horizontal"
showheader=false
autogeneraterows=false
allowpaging pagesize=3>
<fieldheaderstyle width=25%
backcolor="aliceblue" font-bold />
<rowstyle verticalalign="top" />
<pagersettings
mode="nextprevious"
nextpagetext="Next" previouspagetext="Back"
position="top"
pagebuttoncount=10 />
<pagerstyle
backcolor="steelblue" forecolor="beige"
horizontalalign="right" />
<fields>
<asp:boundfield headertext="Design"
datafield="Design" />
<asp:boundfield headertext="Model"
datafield="Model" />
<asp:boundfield headertext="Description"
datafield="Description" />
<asp:boundfield headertext="PlanID"
datafield="PlanID" />
<asp:imagefield headertext="Image"
dataimageurlfield="PlanId"
dataimageurlformatstring="~/shared/images/plans/{0}.jpg"
dataalternatetextfield="Model"
itemstyle-horizontalalign="center"
readonly="true">
<controlstyle borderwidth=1 borderstyle="inset" />
</asp:imagefield>
</fields>
</asp:detailsview>
<asp:accessdatasource id="planTypes" runat="server"
datafile="~/app_data/plans.mdb"
selectcommand="SELECT DISTINCT Type FROM Plans WHERE not Type=''"
datasourcemode="DataReader" />
<asp:accessdatasource id="plans" runat="server"
datafile="~/app_data/plans.mdb"
selectcommand="SELECT Type, Design, Model, Description, PlanId FROM Plans"
filterexpression="Type='{0}'">
<filterparameters>
<asp:controlparameter controlid="typesSelect" propertyname="SelectedValue" />
</filterparameters>
</asp:accessdatasource>
</form>
</div>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>