DetailsView.EnablePagingCallbacks 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示客户端回调函数是否用于 DetailsView 控件中的分页操作。
public:
virtual property bool EnablePagingCallbacks { bool get(); void set(bool value); };
public virtual bool EnablePagingCallbacks { get; set; }
member this.EnablePagingCallbacks : bool with get, set
Public Overridable Property EnablePagingCallbacks As Boolean
属性值
true
表示客户端回调函数用于分页操作;否则为 false
。 默认值为 false
。
示例
下面的代码示例演示如何使用 EnablePagingCallbacks 属性启用对分页操作使用客户端回调函数。
<%@ 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>DetailsView EnablePagingCallbacks Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>DetailsView EnablePagingCallbacks Example</h3>
<asp:detailsview id="CustomerDetailView"
datasourceid="DetailsViewSource"
autogeneraterows="true"
allowpaging="true"
enablepagingcallbacks="true"
runat="server">
<fieldheaderstyle backcolor="Navy"
forecolor="White"/>
<pagersettings mode="NextPreviousFirstLast"
firstpagetext="First"
lastpagetext="Last"
nextpagetext="Next"
previouspagetext="Prev"/>
<pagerstyle forecolor="White"
backcolor="Blue"
font-names="Arial"
font-size="8" />
</asp:detailsview>
<!-- 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="DetailsViewSource" runat="server"
ConnectionString=
"<%$ ConnectionStrings:NorthWindConnectionString%>"
InsertCommand="INSERT INTO [Customers]([CustomerID],
[CompanyName], [Address], [City], [PostalCode], [Country])
VALUES (@CustomerID, @CompanyName, @Address, @City,
@PostalCode, @Country)"
SelectCommand="Select [CustomerID], [CompanyName],
[Address], [City], [PostalCode], [Country] From
[Customers]">
</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 runat="server">
<title>DetailsView EnablePagingCallbacks Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>DetailsView EnablePagingCallbacks Example</h3>
<asp:detailsview id="CustomerDetailView"
datasourceid="DetailsViewSource"
autogeneraterows="true"
allowpaging="true"
enablepagingcallbacks="true"
runat="server">
<fieldheaderstyle backcolor="Navy"
forecolor="White"/>
<pagersettings mode="NextPreviousFirstLast"
firstpagetext="First"
lastpagetext="Last"
nextpagetext="Next"
previouspagetext="Prev"/>
<pagerstyle forecolor="White"
backcolor="Blue"
font-names="Arial"
font-size="8" />
</asp:detailsview>
<!-- 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="DetailsViewSource" runat="server"
ConnectionString=
"<%$ ConnectionStrings:NorthWindConnectionString%>"
InsertCommand="INSERT INTO [Customers]([CustomerID],
[CompanyName], [Address], [City], [PostalCode], [Country])
VALUES (@CustomerID, @CompanyName, @Address, @City,
@PostalCode, @Country)"
SelectCommand="Select [CustomerID], [CompanyName],
[Address], [City], [PostalCode], [Country] From
[Customers]">
</asp:SqlDataSource>
</form>
</body>
</html>
注解
EnablePagingCallbacks使用 属性指定是否使用客户端回调函数执行分页操作。 启用后,将使用回调功能执行分页,这样就不需要将页面发布回服务器。
注意
客户端分页功能仅在 Microsoft Internet Explorer 5.5 及更高版本以及 Netscape 6.0 及更高版本中受支持。
的值 EnablePagingCallbacks 存储在视图状态中。