G
Green
Hi, All
I need to dynamically load a user control and change some properties on
the user control, and display in the aspx page. Unfortunately I failed,
nothing appears.
Please help me look at, thanks.
Comment c = (Comment) Page.LoadControl("Comment.ascx");
Label time = new Label();
time.Text = "5/11/2005";
Label comment = new Label();
comment.Text = "Test ";
LinkButton lb = new LinkButton();
lb.Text = "test button";
c.DateTime = time;
c.Comments = comment;
c.Who = lb;
CommentHolder.Controls.Add(c);
I need to dynamically load a user control and change some properties on
the user control, and display in the aspx page. Unfortunately I failed,
nothing appears.
Please help me look at, thanks.
Comment c = (Comment) Page.LoadControl("Comment.ascx");
Label time = new Label();
time.Text = "5/11/2005";
Label comment = new Label();
comment.Text = "Test ";
LinkButton lb = new LinkButton();
lb.Text = "test button";
c.DateTime = time;
c.Comments = comment;
c.Who = lb;
CommentHolder.Controls.Add(c);