|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Método TemplateControl.ParseControl (String)
Namespace: System.Web.UI
Assembly: System.Web (em System.Web.dll)
Parâmetros
- content
- Tipo: System.String
Uma seqüência de caracteres que contém um controle de usuário.
<%@ Page language="c#" Debug="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>ASP.NET Example</title> <script runat="server"> // System.Web.UI.TemplateControl.ParserControl; // The following example demonstrates the method 'ParseControl' of class TemplateControl. // Since TemplateControl is abstract, this sample has been written using 'Page' class which derives from // 'TemplateControl' class. // A button object is created by passing a string to contstruct a button using ASP syntax, to the // 'ParseControl' method. This button is added as one of the child controls of the page and displayed. void Page_Load(object sender, System.EventArgs e) { Control c = ParseControl("<asp:button text='Click here!' runat='server' />"); myPlaceholder.Controls.Add(c); } </script> </head> <body> <form id="form1" runat="server"> <asp:placeholder id ="myPlaceholder" runat="server" /> </form> </body> </html>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Função Server Core sem suporte), Windows Server 2008 R2 (Função Server Core com suporte com o SP1 ou posterior, Itanium sem suporte)
O .NET Framework não oferece suporte a todas as versões de cada plataforma. Para obter uma lista das versões com suporte, consulte .Requisitos de sistema do NET Framework.