Please note the original reference form asp.net forums
<%@ Page Language="C#" %> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title></title> <script runat="server"> protected void Button1_Click(object sender, EventArgs e) { string controlName = TextBox1.Text; string systemweblib = @"C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll"; System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(systemweblib); Type type = ass.GetType("System.Web.UI.WebControls." + controlName); Control c = (Control)Activator.CreateInstance(type); Panel1.Controls.Add(c); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Create Control" onclick="Button1_Click" /> <asp:Panel ID="Panel1" runat="server"> </asp:Panel> </div> </form> </body> </html>
3 comments:
Great job. Because i'm a newbie in this area this topic was the most useful for me.
Thank you for saying about useful info. It necessary to know that iphone app development could help in your industry by installing customized software products.
Good to see the example of related ASP .NET.example is the way of learning and understanding of each thing than the content.
Post a Comment