Accessing Shared user control properties in code

Topics: Web Client Software Factory, User Forum
Jan 13, 2008 at 8:49 PM
Hi there,

I have a problem using shared user controls. I have a module which I have created in a sub web application project. In my development website I have a shared user control called MenuControl. I have included the user control in a web page in my module. This works perfectly well when I run the website and the user control appears on the page.

The problem comes when I want to set some of the properties of the user control in code from the web page. I have a property in the user control which is a boolean called ShowMenu.

so normally to access this property in c# code I would do something like this

MenuControl MenuControl1 = (MenuControl )Page.FindControl("MenuControl1");
MenuControl1.ShowMenu = false;

Now of course this doesnt work in my sub web application project because it doesnt know about a type of control called MenuControl so I cant even build the project. Does WCSF support accessing shared user controls in this way. Is there anyway to get this to work?

Looking forward to a reply

Thanks,
Cameron