1) Place your complied code in either the GAC, or web application \bin folder.
2) Save your user control to the file system
(usually: "12\TEMPLATE\CONTROLTEMPLATES").
3) Replace the string "MyUserControlPath" with the location of the usercontrol.
4) Deploy web part as normal.
[Guid("9c974b27-d41a-4053-8eb2-76c25e762f1b")]
public class MyWebPart : System.Web.UI.WebControls.WebParts.WebPart
{
public MyWebPart()
{
this.ExportMode = WebPartExportMode.All;
}
protected override void CreateChildControls()
{
try
{
base.CreateChildControls();
this.Controls.Add((System.Web.UI.UserControl)
Page.LoadControl("MyUserControlPath"));
}
catch (Exception ex)
{
EventLog.WriteEntry("WebParts", ex.Message, EventLogEntryType.Error);
}
}
}
1 comment:
Hi, There is also a downside to using too much images on your site in Web Design Cochin and that is it will take more bandwidth to load the whole web pages. Thanks.....
Post a Comment