M
mrsmitty
Okay can't figure out how to get this to work? Works with a standard
TextBox but not my user control? Help is much appreciated. Thanks.
UserControl googleSearch = new UserControl();
googleSearch.LoadControl("GoogleSearch.ascx");
googleSearch.ID = "UserControlGoogleSearch";
WebPart googleWebPart = WebPartManager1.CreateWebPart(googleSearch);
WebPartManager1.AddWebPart(googleWebPart, WebPartZone2, 1);
Exception thrown on last line:
The "path" argument cannot be empty if the "type" argument is
UserControl.
at
System.Web.UI.WebControls.WebParts.WebPartManager.IsAuthorized(Type
type, String path, String authorizationFilter, Boolean isShared)
at
System.Web.UI.WebControls.WebParts.WebPartManager.IsAuthorized(WebPart
webPart)
at
System.Web.UI.WebControls.WebParts.WebPartManager.AddDynamicWebPartToZone(WebPart
webPart, WebPartZoneBase zone, Int32 zoneIndex)
at
System.Web.UI.WebControls.WebParts.WebPartManager.AddWebPart(WebPart
webPart, WebPartZoneBase zone, Int32 zoneIndex)
at _Default.AddWebPart(Object sender, EventArgs e) in
c:\app_dev\SulzerPortal\Default.aspx.cs:line 66
TextBox but not my user control? Help is much appreciated. Thanks.
UserControl googleSearch = new UserControl();
googleSearch.LoadControl("GoogleSearch.ascx");
googleSearch.ID = "UserControlGoogleSearch";
WebPart googleWebPart = WebPartManager1.CreateWebPart(googleSearch);
WebPartManager1.AddWebPart(googleWebPart, WebPartZone2, 1);
Exception thrown on last line:
The "path" argument cannot be empty if the "type" argument is
UserControl.
at
System.Web.UI.WebControls.WebParts.WebPartManager.IsAuthorized(Type
type, String path, String authorizationFilter, Boolean isShared)
at
System.Web.UI.WebControls.WebParts.WebPartManager.IsAuthorized(WebPart
webPart)
at
System.Web.UI.WebControls.WebParts.WebPartManager.AddDynamicWebPartToZone(WebPart
webPart, WebPartZoneBase zone, Int32 zoneIndex)
at
System.Web.UI.WebControls.WebParts.WebPartManager.AddWebPart(WebPart
webPart, WebPartZoneBase zone, Int32 zoneIndex)
at _Default.AddWebPart(Object sender, EventArgs e) in
c:\app_dev\SulzerPortal\Default.aspx.cs:line 66