Evento Paginated

Si verifica quando un form viene impaginato.

public event System.EventHandler Paginated

Osservazioni

Un form viene impaginato prima dell'esecuzione del rendering di ogni richiesta. Una volta completata l'impaginazione, si verifica l'evento Paginated. Al termine dell'evento, la proprietà CurrentPage del form contiene il numero effettivo di pagine per il form.

Esempio

Nell'esempio riportato di seguito viene mostrato come intercettare l'evento Paginated per modificare lo stile di un form impaginato. Vengono impostati stili diversi per form impaginati e non impaginati.

[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 href=#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 
      href=#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 href=#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 
      href=#myForm Text="Back"/>
</mobile:form>

Vedere anche

Classe Form