Monday, December 19, 2005

Loading User Controls into Web Parts

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);

Tuesday, December 13, 2005

Web Site Administration Tool for ASP.NET 2.0 / VS.NET 2005

I looked into "Web Site Administration Tool" source code... It's pretty messy.
Variables have senseless names, code is complex, a lot of unnecessary code, grids are binding 2 times, ...

No wonder that "Web Site Administration Tool" is sluggish and bug-prone.
Moreover, such code is very hard to fix (you fix one bug and getting 2 bugs instead).
I think either Microsoft would either rewrite this tool from scratch or leave as it is.

See also: discussion in microsoft.public.vsnet.general


About Me

My photo
Email me: