Home All Groups Group Topic Archive Search About

Removing the " Web Form Designer Generated Code " region after converting from ASP.NET 1.1 to ASP.NE

Author
5 Jul 2006 3:24 AM
Nathan Sokalski
I recently converted some ASP.NET 1.1 projects of mine, created with Visual
Studio .NET 2003, to Web Application Projects in Visual Studio .NET 2005 so
that I could use ASP.NET 2.0 (All my ASP.NET is done using VB.NET). After
converting, everything was fine, and worked and compiled correctly, but I
noticed one big difference between the VB.NET code of the converted files in
the projects and the VB.NET code in new pages. The new pages use partial
classes and do not have the " Web Form Designer Generated Code " region
where the controls were declared. When I try to modify the code in the
converted files to be like this, I recieve the following error:

Name 'mycontrolid' is not declared.

I am sure this is simply because I am not doing something or I am doing
something wrong, but I cannot figure out what. Any ideas? Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
5 Jul 2006 6:01 AM
Göran_Andersson
The separation of markup and code changed from "code-behind" in VS 2003
to "code-beside" in VS 2005. The @Page directive contains different
properties in the new model.

Nathan Sokalski wrote:
Show quote
> I recently converted some ASP.NET 1.1 projects of mine, created with Visual
> Studio .NET 2003, to Web Application Projects in Visual Studio .NET 2005 so
> that I could use ASP.NET 2.0 (All my ASP.NET is done using VB.NET). After
> converting, everything was fine, and worked and compiled correctly, but I
> noticed one big difference between the VB.NET code of the converted files in
> the projects and the VB.NET code in new pages. The new pages use partial
> classes and do not have the " Web Form Designer Generated Code " region
> where the controls were declared. When I try to modify the code in the
> converted files to be like this, I recieve the following error:
>
> Name 'mycontrolid' is not declared.
>
> I am sure this is simply because I am not doing something or I am doing
> something wrong, but I cannot figure out what. Any ideas? Thanks.
Author
5 Jul 2006 8:32 PM
Nathan Sokalski
That's great, but it still doesn't help me know what I should change my code
to. Here is my current @Page directive and Class definition from my
TextFiles.aspx and TextFiles.aspx.vb files:


<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="TextFiles.aspx.vb" Inherits="WebApplication1.TextFiles"
enableViewState="False"%>

Public Class TextFiles


What changes do I need to make to this?
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quote
"Göran Andersson" <gu***@guffa.com> wrote in message
news:%23yhuth$nGHA.4864@TK2MSFTNGP04.phx.gbl...
> The separation of markup and code changed from "code-behind" in VS 2003 to
> "code-beside" in VS 2005. The @Page directive contains different
> properties in the new model.
>
> Nathan Sokalski wrote:
>> I recently converted some ASP.NET 1.1 projects of mine, created with
>> Visual Studio .NET 2003, to Web Application Projects in Visual Studio
>> .NET 2005 so that I could use ASP.NET 2.0 (All my ASP.NET is done using
>> VB.NET). After converting, everything was fine, and worked and compiled
>> correctly, but I noticed one big difference between the VB.NET code of
>> the converted files in the projects and the VB.NET code in new pages. The
>> new pages use partial classes and do not have the " Web Form Designer
>> Generated Code " region where the controls were declared. When I try to
>> modify the code in the converted files to be like this, I recieve the
>> following error:
>>
>> Name 'mycontrolid' is not declared.
>>
>> I am sure this is simply because I am not doing something or I am doing
>> something wrong, but I cannot figure out what. Any ideas? Thanks.
Author
5 Jul 2006 11:18 PM
Göran_Andersson
As far as I can tell, you only have to change Codebehind to CodeFile.

Nathan Sokalski wrote:
Show quote
> That's great, but it still doesn't help me know what I should change my code
> to. Here is my current @Page directive and Class definition from my
> TextFiles.aspx and TextFiles.aspx.vb files:
>
>
> <%@ Page Language="vb" AutoEventWireup="false"
> Codebehind="TextFiles.aspx.vb" Inherits="WebApplication1.TextFiles"
> enableViewState="False"%>
>
> Public Class TextFiles
>
>
> What changes do I need to make to this?
Author
6 Jul 2006 2:56 AM
Nathan Sokalski
That makes sense, but here are several comments I have about that:

1. When I create a new WebForm it still uses Codebehind. I don't know if
this has something to do with the fact that I am using the Visual Studio
..NET 2005 Web Application Project model instead of the Visual Studio .NET
2005 Website model.

2. If I do change Codebehind to CodeFile I recieve an error saying
'TextFiles' is ambiguous in the namespace 'WebApplication1'.

3. I tried creating one of my simple WebForms from scratch (deleting the
*.aspx and *.aspx.vb files and recreating it using the same controls and vb
code). It compiled and worked with no errors, but when I modify all the
lines of code in other WebForms to look the same (the @Page directive and
!DOCTYPE tag in the *.aspx file and add the Partial keyword to the class
definition in the *.aspx.vb file), it does not work. Is there some
configuration file that gets modified when you create a new WebForm by going
to Add->New Item?

I am not sure why, but simply modifying the *.aspx and *.aspx.vb files of a
WebForm won't let me get rid of the "Web Form Designer Generated Code "
region that used to get added by Visual Studio .NET 2003. If anyone has any
ideas, I would appreciate them.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quote
"Göran Andersson" <gu***@guffa.com> wrote in message
news:OUM1klIoGHA.680@TK2MSFTNGP03.phx.gbl...
> As far as I can tell, you only have to change Codebehind to CodeFile.
>
> Nathan Sokalski wrote:
>> That's great, but it still doesn't help me know what I should change my
>> code to. Here is my current @Page directive and Class definition from my
>> TextFiles.aspx and TextFiles.aspx.vb files:
>>
>>
>> <%@ Page Language="vb" AutoEventWireup="false"
>> Codebehind="TextFiles.aspx.vb" Inherits="WebApplication1.TextFiles"
>> enableViewState="False"%>
>>
>> Public Class TextFiles
>>
>>
>> What changes do I need to make to this?
Author
28 Aug 2006 9:51 PM
Dune
Hi there,

I'm having the exact same problem.

Just wondering if you ever found a resolution or workaround in the end?

Cheers

Show quote
"Nathan Sokalski" wrote:

> That makes sense, but here are several comments I have about that:
>
> 1. When I create a new WebForm it still uses Codebehind. I don't know if
> this has something to do with the fact that I am using the Visual Studio
> ..NET 2005 Web Application Project model instead of the Visual Studio .NET
> 2005 Website model.
>
> 2. If I do change Codebehind to CodeFile I recieve an error saying
> 'TextFiles' is ambiguous in the namespace 'WebApplication1'.
>
> 3. I tried creating one of my simple WebForms from scratch (deleting the
> *.aspx and *.aspx.vb files and recreating it using the same controls and vb
> code). It compiled and worked with no errors, but when I modify all the
> lines of code in other WebForms to look the same (the @Page directive and
> !DOCTYPE tag in the *.aspx file and add the Partial keyword to the class
> definition in the *.aspx.vb file), it does not work. Is there some
> configuration file that gets modified when you create a new WebForm by going
> to Add->New Item?
>
> I am not sure why, but simply modifying the *.aspx and *.aspx.vb files of a
> WebForm won't let me get rid of the "Web Form Designer Generated Code "
> region that used to get added by Visual Studio .NET 2003. If anyone has any
> ideas, I would appreciate them.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
> "Göran Andersson" <gu***@guffa.com> wrote in message
> news:OUM1klIoGHA.680@TK2MSFTNGP03.phx.gbl...
> > As far as I can tell, you only have to change Codebehind to CodeFile.
> >
> > Nathan Sokalski wrote:
> >> That's great, but it still doesn't help me know what I should change my
> >> code to. Here is my current @Page directive and Class definition from my
> >> TextFiles.aspx and TextFiles.aspx.vb files:
> >>
> >>
> >> <%@ Page Language="vb" AutoEventWireup="false"
> >> Codebehind="TextFiles.aspx.vb" Inherits="WebApplication1.TextFiles"
> >> enableViewState="False"%>
> >>
> >> Public Class TextFiles
> >>
> >>
> >> What changes do I need to make to this?
>
>
>
Author
29 Aug 2006 12:28 AM
Nathan Sokalski
What I discovered is that ASP.NET 2.0 organizes the code slightly
differently. The control declarations created by the designer are now put in
a file with the extension *.aspx.designer.vb or *.ascx.designer.vb. If you
want to copy and paste the declarations from ASP.NET 1.1 code into one of
these files, I would suggest that you create one file from scratch so that
you can see what the file looks like, the file layout is very basic. Good
Luck!
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quote
"Dune" <D***@discussions.microsoft.com> wrote in message
news:CED306D3-6F82-4097-9F38-B18DAD3669AD@microsoft.com...
> Hi there,
>
> I'm having the exact same problem.
>
> Just wondering if you ever found a resolution or workaround in the end?
>
> Cheers
>
> "Nathan Sokalski" wrote:
>
>> That makes sense, but here are several comments I have about that:
>>
>> 1. When I create a new WebForm it still uses Codebehind. I don't know if
>> this has something to do with the fact that I am using the Visual Studio
>> ..NET 2005 Web Application Project model instead of the Visual Studio
>> .NET
>> 2005 Website model.
>>
>> 2. If I do change Codebehind to CodeFile I recieve an error saying
>> 'TextFiles' is ambiguous in the namespace 'WebApplication1'.
>>
>> 3. I tried creating one of my simple WebForms from scratch (deleting the
>> *.aspx and *.aspx.vb files and recreating it using the same controls and
>> vb
>> code). It compiled and worked with no errors, but when I modify all the
>> lines of code in other WebForms to look the same (the @Page directive and
>> !DOCTYPE tag in the *.aspx file and add the Partial keyword to the class
>> definition in the *.aspx.vb file), it does not work. Is there some
>> configuration file that gets modified when you create a new WebForm by
>> going
>> to Add->New Item?
>>
>> I am not sure why, but simply modifying the *.aspx and *.aspx.vb files of
>> a
>> WebForm won't let me get rid of the "Web Form Designer Generated Code "
>> region that used to get added by Visual Studio .NET 2003. If anyone has
>> any
>> ideas, I would appreciate them.
>> --
>> Nathan Sokalski
>> njsokal***@hotmail.com
>> http://www.nathansokalski.com/
>>
>> "Göran Andersson" <gu***@guffa.com> wrote in message
>> news:OUM1klIoGHA.680@TK2MSFTNGP03.phx.gbl...
>> > As far as I can tell, you only have to change Codebehind to CodeFile.
>> >
>> > Nathan Sokalski wrote:
>> >> That's great, but it still doesn't help me know what I should change
>> >> my
>> >> code to. Here is my current @Page directive and Class definition from
>> >> my
>> >> TextFiles.aspx and TextFiles.aspx.vb files:
>> >>
>> >>
>> >> <%@ Page Language="vb" AutoEventWireup="false"
>> >> Codebehind="TextFiles.aspx.vb" Inherits="WebApplication1.TextFiles"
>> >> enableViewState="False"%>
>> >>
>> >> Public Class TextFiles
>> >>
>> >>
>> >> What changes do I need to make to this?
>>
>>
>>

AddThis Social Bookmark Button