Link to home
Start Free TrialLog in
Avatar of jxbma
jxbmaFlag for United States of America

asked on

Why am I getting errors viewing my ASP.Net user controls in the Visual Studio Designer?

Hi:

I'm working with ASP.Net in Visual Studio 2010.
I've created several user controls which I include in .aspx pages.
They work fine at runtime, however I run into issues when I am in
"Design" view in Visual Studio.

I've added the following to my web.config:

    <pages>
      <controls>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
        <add src="~/UserControls/UserControl1.ascx" namespace="" tagName="QuantityManagerUserControl" tagPrefix="ucUserControl1" />
        <add src="~/UserControls/UserControl2.ascx"  namespace="" tagName="PopupUserControl" tagPrefix="ucUserControl2" />
      </controls>
    </pages>

Open in new window


The user controls are included directly as part of the current solution.
I do not have name spaces defined for the controls.

Things are fine when I am in "Source View" of the designer.
But, when I go into design view. The controls do not render.
I get the following error message:
Error Rendering Control - UserControl1
An unhandled exception has occurred.
The 'namespace' attribute cannot be an empty string.

Open in new window


I've tried adding namespaces to the controls, removing the namespace tag from the web.config file.
I still get the same errors.

What am I missing here?
What do I need to do additionally in order to view the controls in the Visual Studio designer?

Thanks,
JohnB
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Try adding namespace in lines
<add src="~/UserControls/UserControl1.ascx" namespace="" tagName="QuantityManagerUserControl" tagPrefix="ucUserControl1" />

and use the project name as the namespace.
Avatar of jxbma

ASKER

::>CodeCruiser:

I try adding the project as my namespace in the web config.
Doing so caused additional errors when I looked at page in design view.

It should be noted that I don't have an explicit namespace in my user controls.
I tried adding a namespace there and then referencing that namespace in the web.config and I got the
same errors in design view mentioned above.

Is it possible to provide/point me to a sample that actually works.

Thanks,
JB
ASKER CERTIFIED SOLUTION
Avatar of jxbma
jxbma
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jxbma

ASKER

Nobody responded to answering this. I was able to figure it out on my own.