共用方式為


Paginated 事件

當將表單重新編頁時發生。

public event System.EventHandler Paginated

備註

在呈現每個要求之前先將表單重新編頁。重新編頁完成後,Paginated 事件發生。此事件發生後,表單的 CurrentPage 屬性包含表單的實際頁數。

範例

下列範例示範如何截獲 Paginated 事件來變更已重新編頁表單的樣式。針對已重新編頁和未重新編頁的表單設定不同樣式。

[Visual Basic]

<Script language="vb" runat="server">


Sub Form_Activate(sender As Object, e As EventArgs)

   myForm.Wrapping = System.Web.UI.MobileControls.Wrapping.NoWrap
   Dim a As [String] = "this is a very very long string </br>"
   Dim b As [String] = "START "
   Dim i As Integer
   For i = 0 To 199
      b = b + a
   Next i
   txtvw.Text = b + " END"
   myForm.ControlToPaginate = txtvw

End Sub 


Sub Form_Paginated(sender As Object, e As EventArgs)

   If ActiveForm.PageCount > 1 Then
      ActiveForm.BackColor = System.Drawing.Color.LightGreen

   Else
      ActiveForm.BackColor = System.Drawing.Color.LightBlue
      ActiveForm.StyleReference = "title"

   End If

End Sub

</Script>

<mobile:form id="myForm" runat=server paginate=true 
   OnActivate="Form_Activate" OnPaginated="Form_Paginated">
   <mobile:link id="link1" runat=server NavigateURL=#yourForm 
      Text="Another Form"></mobile:link>
   <mobile:label id="message1" runat=server Font-Italic=true >
      Welcome to ASP.NET
   </mobile:label> 
   <mobile:Textview id=txtvw runat=server />
</mobile:form>

<mobile:form id="yourForm" runat=server paginate=true 
   OnPaginated="Form_Paginated">
   <mobile:label id="message2" runat=server 
      Text="Welcome to ASP.NET"/> 
   <mobile:link id="link2" runat=server 
      NavigateURL=#myForm Text="Back"/>
</mobile:form>
<script language="c#" runat=server>

void Form_Activate(object sender, EventArgs e)
{
   myForm.Wrapping=System.Web.UI.MobileControls.Wrapping.NoWrap;
   String a = "this is a very very long string </br>";
   String b = "START ";
   for (int i=0; i<200; i++)
      b = b + a;
   txtvw.Text = b + " END";
   myForm.ControlToPaginate = txtvw;
}

void Form_Paginated(object sender, EventArgs e)
{   
   if(ActiveForm.PageCount>1)
   {
      ActiveForm.BackColor = System.Drawing.Color.LightGreen; 
   }
   else
   {
      ActiveForm.BackColor = System.Drawing.Color.LightBlue;       
      ActiveForm.StyleReference = "title";
   }
}

</script>

<mobile:form id="myForm" runat=server paginate=true 
   OnActivate="Form_Activate" OnPaginated="Form_Paginated">
   <mobile:link id="link1" runat=server NavigateURL=#yourForm 
      Text="Another Form"></mobile:link>
   <mobile:label id="message1" runat=server Font-Italic=true >
      Welcome to ASP.NET
   </mobile:label> 
   <mobile:Textview id=txtvw runat=server />
</mobile:form>

<mobile:form id="yourForm" runat=server paginate=true 
   OnPaginated="Form_Paginated">
   <mobile:label id="message2" runat=server 
      Text="Welcome to ASP.NET"/> 
   <mobile:link id="link2" runat=server 
      NavigateURL=#myForm Text="Back"/>
</mobile:form>

請參閱

Form 類別