Create Google.ascx as a web part article demonstrates how to create User Control and insert it into Web part.
Tip from the article: in order to get rid of "Untitled" header in Web part - define title attribute for user control:
<uc1:Google title="Google Search" runat="server" ID="Google1" />
Personalize Your Portal with User Controls and Custom Web Parts article demonstrates how to bind User Control to Web Part dynamically:
// create Web Part instance from User Control file
Control uc = this.LoadControl(@"webparts\CompanyNews.ascx");
uc.ID = "wp2";
GenericWebPart wp2 = WebPartManager1.CreateWebPart(uc);
WebPartManager1.AddWebPart(wp2, WebPartZone1, 1);
Monday, December 19, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment