PagerSettings.Mode プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ページ分割をサポートするコントロールでポケットベル コントロールを表示するモードを取得または設定します。
public:
property System::Web::UI::WebControls::PagerButtons Mode { System::Web::UI::WebControls::PagerButtons get(); void set(System::Web::UI::WebControls::PagerButtons value); };
public System.Web.UI.WebControls.PagerButtons Mode { get; set; }
member this.Mode : System.Web.UI.WebControls.PagerButtons with get, set
Public Property Mode As PagerButtons
プロパティ値
PagerButtons値の 1 つ。 既定値は、PagerButtons.Numeric です。
例外
Modeは、PagerButtons値の 1 つではない値に設定されます。
例
次のコード例では、 Mode プロパティを使用して、 GridView コントロールのポケットベル行に数値ボタンを表示するように指定する方法を示します。
<%@ 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>PagerSetting Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>PagerSetting Example</h3>
<asp:gridview id="CustomerGridView"
datasourceid="CustomerDataSource"
autogeneratecolumns="true"
datakeynames="CustomerID"
allowpaging="true"
runat="server">
<pagersettings mode="NumericFirstLast"
firstpagetext="First"
lastpagetext="Last"
pagebuttoncount="5"
position="Bottom"/>
</asp:gridview>
<br/>
<asp:label id="MessageLabel"
forecolor="Red"
runat="server"/>
<!-- 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="CustomerDataSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
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>PagerSetting Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>PagerSetting Example</h3>
<asp:gridview id="CustomerGridView"
datasourceid="CustomerDataSource"
autogeneratecolumns="true"
datakeynames="CustomerID"
allowpaging="true"
runat="server">
<pagersettings mode="NumericFirstLast"
firstpagetext="First"
lastpagetext="Last"
pagebuttoncount="5"
position="Bottom"/>
</asp:gridview>
<br/>
<asp:label id="MessageLabel"
forecolor="Red"
runat="server"/>
<!-- 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="CustomerDataSource"
selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
runat="server"/>
</form>
</body>
</html>
注釈
改ページ調整をサポートするコントロールには、ページング コントロールを表示する複数のモードが用意されています。 モードを指定するには、 Mode プロパティを使用します。 次の表では、改ページ調整コントロールのさまざまなモードについて説明します。
| モード | 説明 |
|---|---|
| NextPrevious | [前のページ] ボタンと [次ページ] ボタン。 |
| NextPreviousFirstLast | 前のページ、次のページ、最初のページ、および最後のページのボタン。 |
| Numeric | ページに直接アクセスするための番号付きリンク ボタン。 |
| NumericFirstLast | 番号付きボタンと最初のリンク ボタンと最後のリンク ボタン。 |
Mode プロパティがNextPrevious、NextPreviousFirstLast、またはNumericFirstLast値に設定されている場合は、次の表に示すプロパティを設定することで、数値以外のボタンのカスタム テキストを指定できます。
| 財産 | 説明 |
|---|---|
| FirstPageText | 最初のページ ボタンのテキスト。 |
| PreviousPageText | 前のページ ボタンのテキスト。 |
| NextPageText | 次ページ ボタンのテキスト。 |
| LastPageText | 最後のページ ボタンのテキスト。 |
別の方法として、次の表に示すプロパティを設定することで、数値以外のボタンの画像を表示することもできます。
| 財産 | 説明 |
|---|---|
| FirstPageImageUrl | 最初のページ ボタンに表示する画像の URL。 |
| PreviousPageImageUrl | 前のページ ボタンに表示する画像の URL。 |
| NextPageImageUrl | 次ページ ボタンに表示する画像の URL。 |
| LastPageImageUrl | 最後のページ ボタンに表示する画像の URL。 |
注
イメージ プロパティを設定すると、対応する text プロパティがイメージの代替テキストとして機能します。 たとえば、 FirstPageImageUrl プロパティを設定すると、 FirstPageText プロパティで指定されたテキストが画像の代替テキストとして表示されます。 ツールヒントをサポートするブラウザーでは、このテキストは、対応するボタンのツールヒントとしても表示されます。
このプロパティの値はビューステートに格納されます。