WebPartMobileExpandCollapseScriptManager.Render method
NOTE: This API is now obsolete.
Processa o código ECMAScript que implementa expandindo e recolhendo uma Web Part em uma página móvel.
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
<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
writer
Type: System.Web.UI.HtmlTextWriterO objeto que realmente grava o elemento script HTML.
Comentários
Notes to callers
Chamando código deve verificar se o navegador atual suporta ECMAScript 1 e CSS antes de chamar esse método.
Notes to inheritors
Se você substituir esse método, seu código deve verificar que a página é um WebPartMobilePage.
Examples
Este é um exemplo de uma substituição desse 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
Ver também
Referência
WebPartMobileExpandCollapseScriptManager class