FormView.PagerSettings Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan referensi ke PagerSettings objek yang memungkinkan Anda mengatur properti tombol pager dalam FormView kontrol.
public:
virtual property System::Web::UI::WebControls::PagerSettings ^ PagerSettings { System::Web::UI::WebControls::PagerSettings ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.PagerSettings PagerSettings { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.PagerSettings : System.Web.UI.WebControls.PagerSettings
Public Overridable ReadOnly Property PagerSettings As PagerSettings
Nilai Properti
Referensi ke PagerSettings yang memungkinkan Anda mengatur properti tombol pager dalam FormView kontrol.
- Atribut
Contoh
Contoh berikut menunjukkan cara menggunakan PagerSettings properti untuk menentukan properti baris pager.
<%@ Page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>FormView AllowPaging Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>FormView AllowPaging Example</h3>
<asp:formview id="EmployeeFormView"
datasourceid="EmployeeSource"
allowpaging="true"
datakeynames="EmployeeID"
runat="server">
<pagersettings mode="Numeric"
position="Bottom"/>
<pagerstyle backcolor="LightBlue"
horizontalalign="Center"/>
<itemtemplate>
<table>
<tr>
<td>
<asp:image id="EmployeeImage"
imageurl='<%# Eval("PhotoPath") %>'
alternatetext='<%# Eval("LastName") %>'
runat="server"/>
</td>
<td>
<h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>
<%# Eval("Title") %>
</td>
</tr>
</table>
</itemtemplate>
</asp:formview>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:sqldatasource id="EmployeeSource"
selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</form>
</body>
</html>
<%@ Page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>FormView AllowPaging Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>FormView AllowPaging Example</h3>
<asp:formview id="EmployeeFormView"
datasourceid="EmployeeSource"
allowpaging="true"
datakeynames="EmployeeID"
runat="server">
<pagersettings mode="Numeric"
position="Bottom"/>
<pagerstyle backcolor="LightBlue"
horizontalalign="Center"/>
<itemtemplate>
<table>
<tr>
<td>
<asp:image id="EmployeeImage"
imageurl='<%# Eval("PhotoPath") %>'
alternatetext='<%# Eval("LastName") %>'
runat="server"/>
</td>
<td>
<h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>
<%# Eval("Title") %>
</td>
</tr>
</table>
</itemtemplate>
</asp:formview>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the Northwind sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:sqldatasource id="EmployeeSource"
selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</form>
</body>
</html>
Keterangan
PagerSettings Gunakan properti untuk mengontrol pengaturan baris pager dalam FormView kontrol. Baris pager ditampilkan saat fitur halaman diaktifkan (saat AllowPaging properti diatur ke true), dan berisi kontrol yang memungkinkan pengguna menavigasi ke rekaman yang berbeda dalam kontrol. Properti ini bersifat baca-saja; namun, Anda dapat mengatur properti objek yang PagerSettings dikembalikannya. Properti dapat diatur secara deklaratif dalam formulir Property-Subproperty, di mana Subproperty adalah properti PagerSettings objek (misalnya, PagerSettings-Mode). Properti juga dapat diatur secara terprogram dalam formulir Property.Subproperty (misalnya, PagerSettings.Mode). Pengaturan umum biasanya mencakup mode tampilan baris pager dan teks atau gambar kustom untuk kontrol navigasi.