Using an ASP.NET User Web Control on a WSS WebPart
-
I've spent an hour trying to do this and I can't figure out what's going on. I have a class that I derived from Microsoft.SharePoint.WebPartPages.WebPart. I built the program, and copied the dll's to C:\inetpub\wwwroot\wss\VirtualDirectories\3141\bin. I registered the WebPart through a dwp file. The webpart works great (queries a database and outputs text). I'm trying to build a User Control and include it in the webpart. To do this I put this in the Web Part's Render method:
System.Web.UI.Control control = this.TemplateControl.LoadControl(@"WebUserControl.ascx"); Controls.Add(control);
because of various examples online. Program compiles fine. I copied the WebUserControl.ascx all over the place to over all the tutorials I found that had it different places. Before I copied it to a lot of places I was getting WebUserControl.ascx file not found. Now I'm getting the exception:Request Failed
Anyone have any ideas about what I'm not doing right? I'm not installing the dll to the GAC, I'm not sure if that has anything to do with it. Thanks, -Ken -
I've spent an hour trying to do this and I can't figure out what's going on. I have a class that I derived from Microsoft.SharePoint.WebPartPages.WebPart. I built the program, and copied the dll's to C:\inetpub\wwwroot\wss\VirtualDirectories\3141\bin. I registered the WebPart through a dwp file. The webpart works great (queries a database and outputs text). I'm trying to build a User Control and include it in the webpart. To do this I put this in the Web Part's Render method:
System.Web.UI.Control control = this.TemplateControl.LoadControl(@"WebUserControl.ascx"); Controls.Add(control);
because of various examples online. Program compiles fine. I copied the WebUserControl.ascx all over the place to over all the tutorials I found that had it different places. Before I copied it to a lot of places I was getting WebUserControl.ascx file not found. Now I'm getting the exception:Request Failed
Anyone have any ideas about what I'm not doing right? I'm not installing the dll to the GAC, I'm not sure if that has anything to do with it. Thanks, -KenKen, I could never do sharepoint programming. However, I know an easy way to use user controls in SP webparts. Check this out. http://www.codeplex.com/smartpart[^] This is the easy way to implement a .ascx as a webpart.
I didn't get any requirements for the signature