CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: Date Entered: 8/3/2006 10:25:26 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 7 Views: 37 Favorited: 0 Favorite
8 Items, 1 Pages 1 |< << Go >> >|
"akashenk" <>
NewsGroup User
designer creates invalid user control code8/3/2006 10:25:26 AM

0

I have a User Control called DialogControlPanel. The partial class for the user control is in the "Controls" namespace. The default namespace for the application is WOU.Apps.WebPortal, so the fully qualified name for the class is WOU.Apps.WebPortal.Controls.DialogControlPanel

I have a webform which contains this User control. The user control is registerd with ...

<%

@ Register Src="../common/controls/DialogControlPanel.ascx" TagName="DialogControlPanel" TagPrefix="uc1" %>

This registration is created automatically when I drag the user control onto the webform.

Everything is fine except the following... the desiger.vb file for the webform creates the following entry

Protected

WithEvents DialogControlPanel1 As Controls.DialogControlPanel

This won't compile because I get a "Type Controls.DialogControlPanel is undefined" error. The webform exists in a separate namespace called "Forums". If I provide the fully qualified definition...

Protected WithEvents DialogControlPanel1 As WOU.Apps.WebPortal.Controls.DialogControlPanel,

then it compiles, however, whenever I make a change to the webform, the designer page is recreated and it once again has the unqualified name. Is this a bug in VS, or is there a way to specify that the designer should declare controls with fully-qualified namespaces?

Thanks,

Al

"samsp" <>
NewsGroup User
Re: designer creates invalid user control code8/3/2006 8:46:32 PM

0

I'm not sure of an option to change the code generation.

Could you add an import/using for WOU.Apps.WebPortal so that the declared type will work?

"akashenk" <>
NewsGroup User
Re: designer creates invalid user control code8/3/2006 9:13:58 PM

0

I can always directly specify the fully-qualified name like so:

Protected WithEvents DialogControlPanel1 As WOU.Apps.WebPortal.Controls.DialogControlPanel

or include an Imports WOU.Apps.WebPortal statement. This will get it to compile.  However, the designer file gets overwritten every time the aspx page is changed, so making manual changes to it obviously won't work. The bottom line is, I don't know why the compiler doesn't recognize Controls.DialogControlPanel as a valid class if the application has a root namespace of WOU.Apps.WebPortal. I shouldn't have to declare this.

"timmcb" <>
NewsGroup User
Re: designer creates invalid user control code8/4/2006 8:53:19 PM

0

You can delete the declaration from the designer file and put it in the codebehind file.  Once moved to the codebehind file it will remain there unaltered -- even if you change the page.  This will allow you to work-around the issue.

There were some bugs related to VB that required us to generate the type differently than normal.  I'm not sure if that is the case here.  Can you post the @Control directive from your user control and the default namespace from your project settings?


Tim McBride

This posting is provided "AS IS" with no warranties, and confers no rights.
"akashenk" <>
NewsGroup User
Re: designer creates invalid user control code8/8/2006 4:04:35 AM

0

Here it is...

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="DialogControlPanel.ascx.vb" Inherits="WOU.Apps.WebPortal.Controls.DialogControlPanel" %>

Web App default namespace is WOU.Apps.WebPortal

Partial Class for UserControl is called DialogControlPanel and is in namespace Controls

Web Page is in namespace Forums and imports the UserControl

 

"timmcb" <>
NewsGroup User
Re: designer creates invalid user control code8/10/2006 4:21:17 PM

0

Thanks for the info!  I was able to reproduce the problem.  I have a fix that will be in the next version of Visual Studio.  For now you will need to use the work-around I outlined previously.
Tim McBride

This posting is provided "AS IS" with no warranties, and confers no rights.
"akashenk" <>
NewsGroup User
Re: designer creates invalid user control code8/10/2006 4:44:41 PM

0

No problem... Will there be an inexpensive VS 2006/2007 Upgrade product, or will this be available as some sort of hotfix or release package?
"timmcb" <>
NewsGroup User
Re: designer creates invalid user control code8/11/2006 12:40:16 AM

0

We are working on a service pack for VS 2005.  I'm trying to get the fix in the SP but it may not happen.  The SP will be free.  We don't have any dates or pricing for future versions of VS at this time.  However, there normally is a less expensive upgrade price.
Tim McBride

This posting is provided "AS IS" with no warranties, and confers no rights.
8 Items, 1 Pages 1 |< << Go >> >|




   
  Privacy | Contact Us
All Times Are GMT