DataPager.PagedControlID Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
public:
virtual property System::String ^ PagedControlID { System::String ^ get(); void set(System::String ^ value); };
[System.Web.UI.Themeable(false)]
public virtual string PagedControlID { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.PagedControlID : string with get, set
Public Overridable Property PagedControlID As String
Özellik Değeri
ID Denetim tarafından sayfalanacak verileri içeren denetimin.DataPager Varsayılan, bu özelliğin ayarlanmadığını gösteren boş bir dizedir.
- Öznitelikler
Örnekler
Aşağıdaki örnek, bir denetimi bir ListView denetimle DataPager dinamik olarak ilişkilendirmek için özelliğinin nasıl kullanılacağını PagedControlID gösterir. Bu kod örneği, oluşturucu için DataPager sağlanan daha büyük bir örneğin parçasıdır.
protected void Page_Load(object sender, EventArgs e)
{
// Create a new DataPager object.
DataPager CountryDataPager = new DataPager();
// Set the DataPager object's properties.
CountryDataPager.PagedControlID = CountryListView.ID;
CountryDataPager.PageSize = 15;
CountryDataPager.Fields.Add(new NumericPagerField());
// Add the DataPager object to the Controls collection
// of the form.
form1.Controls.Add(CountryDataPager);
CountryListView.DataBind();
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
' Create a new DataPager object.
Dim CountryDataPager As New DataPager()
' Set the DataPager object's properties.
CountryDataPager.PagedControlID = CountryListView.ID
CountryDataPager.PageSize = 15
CountryDataPager.Fields.Add(New NumericPagerField())
' Add the DataPager object to the Controls collection
' of the form.
form1.Controls.Add(CountryDataPager)
CountryListView.DataBind()
End Sub
Aşağıdaki örnekte, bir DataPager denetimin PagedControlID verilerinin sayfalanması için denetimde özelliğinin nasıl bildirim temelli olarak ayarlanacağı gösterilmektedirListView.
<%@ 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 id="Head1" runat="server">
<title>DataPager PagedControlID Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>DataPager PagedControlID Example</h3>
<asp:DataPager ID="DepartmentsPager" runat="server"
PagedControlID="DepartmentsListView">
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
<asp:ListView ID="DepartmentsListView"
DataSourceID="DepartmentsDataSource"
runat="server">
<LayoutTemplate>
<table cellpadding="2" width="500px">
<tr>
<th>Department Name</th>
<th>Group</th>
</tr>
<tr runat="server" id="itemPlaceholder"></tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
<td>
<asp:Label ID="GroupNameLabel" runat="server" Text='<%# Eval("GroupName") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the AdventureWorks sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:SqlDataSource ID="DepartmentsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
SelectCommand="SELECT Name, GroupName FROM HumanResources.Department" >
</asp:SqlDataSource>
</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 id="Head1" runat="server">
<title>DataPager PagedControlID Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>DataPager PagedControlID Example</h3>
<asp:DataPager ID="DepartmentsPager" runat="server"
PagedControlID="DepartmentsListView">
<Fields>
<asp:NumericPagerField />
</Fields>
</asp:DataPager>
<asp:ListView ID="DepartmentsListView"
DataSourceID="DepartmentsDataSource"
runat="server">
<LayoutTemplate>
<table cellpadding="2" width="500px">
<tr>
<th>Department Name</th>
<th>Group</th>
</tr>
<tr runat="server" id="itemPlaceholder"></tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
<td>
<asp:Label ID="GroupNameLabel" runat="server" Text='<%# Eval("GroupName") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the AdventureWorks sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:SqlDataSource ID="DepartmentsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
SelectCommand="SELECT Name, GroupName FROM HumanResources.Department" >
</asp:SqlDataSource>
</form>
</body>
</html>
Açıklamalar
PagedControlID denetimi tarafından DataPager sayfalanacak verileri içeren denetimin değerini belirtmek ID için özelliğini kullanın. Belirtilen denetim arabirimini IPageableItemContainer uygulamalı ve denetimle aynı adlandırma kapsayıcısını DataPager kullanmalıdır. Belirtebileceğiniz bir denetim örneği, denetimdir ListView .
Bu özellik boş bir dize veya null
ise, denetim kapsayıcı denetiminin DataPagerIPageableItemContainer arabirimi uygulayıp uygulamadığını denetler. Örneğin, denetimdeListView, denetimi şablonun PagedControlID içine ListView.LayoutTemplate koyarsanız özelliğinin DataPager ayarlanması gerekmez. Bunun nedeni, denetimin DataPager denetim ağacını ListView inceleyerek denetimi otomatik olarak bulabilmesidir.
Bu özelliğin değeri görünüm durumunda depolanır.
Şunlara uygulanır
Ayrıca bkz.
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin