I am currently building a web app that will become the new data center (intranet website) for my company. I have it hooked into active directory and have a user group set up to allow page editing. I am creating a usercontrol to give our QA manager more editing power so that he can manage the site without me having to re-code anything.
Here's my issue: As I am using a usercontrol as the new edit control; I need to be able to access the controls on whatever page the edit control is being used on. For the life of me I cant figure out how.
Here is a simple example of what I'm trying to do:
WebPartManager wpm = (WebPartManager)WebPartManager.GetCurrentWebPartManager(this.Page);
TextBox testBox = new TextBox
{
ForeColor = System.Drawing.Color.Blue,
ID = "testID",
Width = 500,
Height = 200
};
GenericWebPart testGWP = wpm.CreateWebPart(testBox);
wpm.AddWebPart(testGWP, WebPartZone4, 1); //heres where I get my error. WebPartZone4 is a webPartZone in one of my pages.
If I run this code on the page that has said WebPartZone the desired effect is achieved so I know the code works. My usercontrol just cant see the WebPartZone on another page. Any help at all would be great. Thank you.