Compartir a través de


del método WebPartMobileExpandCollapseScriptManager.Render

NOTA: esta API está ahora obsoleta.

Representa el código ECMAScript que implementa expandir y contraer un elemento Web en una página móvil.

Espacio de nombres:  Microsoft.SharePoint.WebPartPages
Ensamblado:  Microsoft.SharePoint (en Microsoft.SharePoint.dll)

Sintaxis

'Declaración
<ObsoleteAttribute("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see https://go.microsoft.com/fwlink/?LinkId=157231.")> _
Protected Overrides Sub Render ( _
    writer As HtmlTextWriter _
)
'Uso
Dim writer As HtmlTextWriter

Me.Render(writer)
[ObsoleteAttribute("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see https://go.microsoft.com/fwlink/?LinkId=157231.")]
protected override void Render(
    HtmlTextWriter writer
)

Parámetros

Comentarios

Notas para los llamadores

Llamar a código debe comprobar que el explorador actual admite CSS y ECMAScript 1.x.x antes de llamar a este método.

Notas para los desarrolladores de herederos

Si invalida este método, el código debe comprobar que la página es un WebPartMobilePage.

Ejemplos

El siguiente es un ejemplo de una invalidación de este método.

 protected override void Render(HtmlTextWriter writer)
{
    WebPartMobilePage mobilePage = this.MobilePage as WebPartMobilePage;
    if (null == mobilePage)
    {
        return;
    }

    if (mobilePage.SupportsExpandCollapse)
    {
        StringBuilder scriptString = new StringBuilder();
    
        scriptString.AppendLine();
        scriptString.AppendLine("<script type=\"text/javascript\">");
        scriptString.AppendLine("// <![CDATA[");
        scriptString.Append("function ");
        scriptString.Append("MyExpandCollapseToggle");
        scriptString.AppendLine("(container){");
        scriptString.AppendLine("  if (container.style.display != 'none'){");
        scriptString.AppendLine("    container.style.display = 'none';}");
        scriptString.AppendLine("  else {");
        scriptString.AppendLine("    container.style.display = '';}");
        scriptString.AppendLine("}");
        scriptString.AppendLine("// ]]>");
        scriptString.AppendLine("</script>");
        scriptString.AppendLine();

        writer.Write(scriptString.ToString());
    }
}
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
    Dim mobilePage As WebPartMobilePage = TryCast(Me.MobilePage, WebPartMobilePage)
    If Nothing Is mobilePage Then
        Return
    End If

    If mobilePage.SupportsExpandCollapse Then
        Dim scriptString As New StringBuilder()

        scriptString.AppendLine()
        scriptString.AppendLine("<script type=""text/javascript"">")
        scriptString.AppendLine("// <![CDATA[")
        scriptString.Append("function ")
        scriptString.Append("MyExpandCollapseToggle")
        scriptString.AppendLine("(container){")
        scriptString.AppendLine("  if (container.style.display != 'none'){")
        scriptString.AppendLine("    container.style.display = 'none';}")
        scriptString.AppendLine("  else {")
        scriptString.AppendLine("    container.style.display = '';}")
        scriptString.AppendLine("}")
        scriptString.AppendLine("// ]]>")
        scriptString.AppendLine("</script>")
        scriptString.AppendLine()

        writer.Write(scriptString.ToString())
    End If
 End Sub

Vea también

Referencia

clase WebPartMobileExpandCollapseScriptManager

Miembros WebPartMobileExpandCollapseScriptManager

Espacio de nombres Microsoft.SharePoint.WebPartPages