Share via


Form.PageCount Propiedad

Definición

Devuelve el número de páginas del formulario después de la paginación del formulario. Esta API está obsoleta. Para obtener información sobre cómo desarrollar aplicaciones móviles ASP.NET, consulte Mobile Apps & Sites with ASP.NET.

public:
 property int PageCount { int get(); };
[System.ComponentModel.Bindable(false)]
[System.ComponentModel.Browsable(false)]
public int PageCount { get; }
[<System.ComponentModel.Bindable(false)>]
[<System.ComponentModel.Browsable(false)>]
member this.PageCount : int
Public ReadOnly Property PageCount As Integer

Valor de propiedad

El número de páginas del formulario después de la paginación del formulario.

Atributos

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar la PageCount propiedad del Form control . Este ejemplo de código forma parte de un ejemplo más grande para la ControlToPaginate propiedad .

void Form_Paginated(object sender, EventArgs e)
{
    // Set the background color based on 
    // the number of pages
    if (ActiveForm.PageCount > 1)
        ActiveForm.BackColor = Color.LightBlue;
    else
        ActiveForm.BackColor = Color.LightGray;

    // Check to see if the Footer template has been chosen
    if (DevSpec.HasTemplates)
    {   
        System.Web.UI.MobileControls.Label lbl = null;
        
        // Get the Footer panel
        System.Web.UI.MobileControls.Panel pan = Form1.Footer;

        // Get the Label from the panel
        lbl = (System.Web.UI.MobileControls.Label)pan.FindControl("lblCount");
        // Set the text in the Label
        lbl.Text = "Page #" + Form1.CurrentPage.ToString();
    }
}
Private Sub Form_Paginated(ByVal sender As Object, _
    ByVal e As EventArgs)
    
    ' Set the background color based on 
    ' the number of pages
    If ActiveForm.PageCount > 1 Then
        ActiveForm.BackColor = Color.LightBlue
    Else
        ActiveForm.BackColor = Color.LightGray
    End If
    
    ' Check to see if the Footer template has been chosen
    If DevSpec.HasTemplates Then
        Dim lbl As System.Web.UI.MobileControls.Label
        
        ' Get the Footer panel
        Dim pan As System.Web.UI.MobileControls.Panel = Form1.Footer

        ' Get the Label from the panel
        lbl = CType(pan.FindControl("lblCount"), System.Web.UI.MobileControls.Label)
        ' Set the text in the Label
        lbl.Text = "Page #" + Form1.CurrentPage.ToString()
    End If
End Sub

Comentarios

El Form control expone la PageCount propiedad y la CurrentPage propiedad , que proporcionan información sobre cómo se pagina el formulario actual. La PageCount propiedad también ayuda a proporcionar funcionalidad de navegación a otra página. Por ejemplo, al representar en un dispositivo más completo, un formulario de resultados de búsqueda podría incluir elementos de interfaz de usuario específicos del dispositivo que permiten al usuario navegar a una página de resultados por número en lugar de por navegación por vínculo.

Nota:

Este valor está disponible después de que se haya producido el Paginated evento. Para obtener la PageCount propiedad , puede controlar el Paginated evento del formulario.

Se aplica a

Consulte también