Problem to create webPart dynamically!
-
Hi i have a simple web app which display some webparts from external assemblies. user can select available webParts and add to selected zone via this code :
Type type = _dicWebparts[this.ddlWebParts.SelectedValue];
WebPart webPart = (WebPart)Activator.CreateInstance(type);
this.WebPartManager1.AddWebPart(webPart, this.WebPartManager1.Zones[this.ddlZones.SelectedValue], 0); // cause error!!but as u see in the last line (where cause the problem), i'm facing this error :
System.InvalidOperationException: Cannot add a control of Type MyWebPart1.MyWebPart1. The Type must be loadable by BuildManager.GetType(string typeName).
How to solve this problem ? thanks in advance
-
Hi i have a simple web app which display some webparts from external assemblies. user can select available webParts and add to selected zone via this code :
Type type = _dicWebparts[this.ddlWebParts.SelectedValue];
WebPart webPart = (WebPart)Activator.CreateInstance(type);
this.WebPartManager1.AddWebPart(webPart, this.WebPartManager1.Zones[this.ddlZones.SelectedValue], 0); // cause error!!but as u see in the last line (where cause the problem), i'm facing this error :
System.InvalidOperationException: Cannot add a control of Type MyWebPart1.MyWebPart1. The Type must be loadable by BuildManager.GetType(string typeName).
How to solve this problem ? thanks in advance