Paginated Event
Occurs when a form is paginated.
public event System.EventHandler Paginated
Remarks
A form is paginated prior to rendering each request. After pagination is complete, the Paginated event occurs. After this event occurs, the CurrentPage property of the form contains the actual number of pages for the form.
Example
The following example demonstrates how to trap the Paginated event to change the style for a paginated form. Different styles are set for paginated and nonpaginated forms.
[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>
See Also
Form Class