In previous post I have wrote about UserControlTool. In this post I will show how to add the UserControlTool dynamically in an aspx page.
First add the folder as a namespace into the .CS page.
Suppose project name is "asx_add" and in the folder "tool" all the user control tools are presented.
So add the namespace.
Now add the line bellow to add the control tool.
Now run the code and you will found that the user control is added to your web page.
Download the full source code here.
First add the folder as a namespace into the .CS page.
Suppose project name is "asx_add" and in the folder "tool" all the user control tools are presented.
So add the namespace.
using asx_add.tools;
Now add the line bellow to add the control tool.
private Header h1;
h1 = (Header)LoadControl("~/tools/Header.ascx");
this.Controls.Add(h1);
PlaceHolder1.Controls.Add(h1);
Now run the code and you will found that the user control is added to your web page.
Download the full source code here.
0 comments:
Post a Comment