-
VS.Net and Code Behind
I was wondering if anyone knows a way of changing Visual Studio .Net's
behavior when dealing with code behind files, or perhaps explain in detail
why MS forces you to use code behind. I personally do not like using code
behind files. I would prefer to use inline coding or store the code for a
particular page in a DLL mainly to easily maintain the file structure of an
ASP.Net application. I haven't been able to locate a way to change this
inside VS. MS Web Matrix doesn't force you to use code behind, so why does
Visual Studio .Net? In Visual Studio .Net you can't even store the code in
a DLL file and have it inherit from a particular class without VS freaking
out when you try to load the .aspx or .ascx file into the editor. It's
VERY irritating.
Chaitanya Marvici
-
Re: VS.Net and Code Behind
Visual Studio doesn't force you to use code-behind either--you're perfectly
free to write inline code in the HTML view. I'm curious about your other
preference though. Why would you want to have multiple DLLs--one for each
page?
"Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote in message
news:3f145130$1@tnews.web.devx.com...
> I was wondering if anyone knows a way of changing Visual Studio .Net's
> behavior when dealing with code behind files, or perhaps explain in detail
> why MS forces you to use code behind. I personally do not like using
code
> behind files. I would prefer to use inline coding or store the code for
a
> particular page in a DLL mainly to easily maintain the file structure of
an
> ASP.Net application. I haven't been able to locate a way to change this
> inside VS. MS Web Matrix doesn't force you to use code behind, so why
does
> Visual Studio .Net? In Visual Studio .Net you can't even store the code
in
> a DLL file and have it inherit from a particular class without VS freaking
> out when you try to load the .aspx or .ascx file into the editor. It's
> VERY irritating.
>
> Chaitanya Marvici
>
>
>
-
Re: VS.Net and Code Behind
You misunderstood me. I have 1 DLL that contains ALL the classes for the
pages. My problem is not that VS doesn't let you use inline code or
storing the code in a DLL, but that it freaks out whenever you try to load a
page that is doing either. If I create a blank solution inside VS, then
add the VB files that are used to Build the DLL to the project, then try to
add one of the ASPX files that is using a class inside that DLL, VS says
that "There is not a class associated with that file, would you like to
create one?". I say no, then whenever the ASPX is loaded it goes to the
designer screen stating that same thing. It doesn't gracefully handle
doing anything besides code behind.
Another thing, is if you are trying to use inline code, the intellisense
doesn't work. So in effect, the main reason that I would use VSS over
another IDE does not work. So, as it stands now, I am editing all of my
web pages in Dreamweaver, and using VS to create the DLL's that I need for
my application.
I'm probably not doing a good job of explaining the issue, but if you are
still not understanding, i'll sure try again. 
Chaitanya Marvici
"Russell Jones" <arj1@nospam.northstate.net> wrote in message
news:3f1457fd@tnews.web.devx.com...
> Visual Studio doesn't force you to use code-behind either--you're
perfectly
> free to write inline code in the HTML view. I'm curious about your other
> preference though. Why would you want to have multiple DLLs--one for each
> page?
>
> "Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote in message
> news:3f145130$1@tnews.web.devx.com...
> > I was wondering if anyone knows a way of changing Visual Studio .Net's
> > behavior when dealing with code behind files, or perhaps explain in
detail
> > why MS forces you to use code behind. I personally do not like using
> code
> > behind files. I would prefer to use inline coding or store the code
for
> a
> > particular page in a DLL mainly to easily maintain the file structure of
> an
> > ASP.Net application. I haven't been able to locate a way to change
this
> > inside VS. MS Web Matrix doesn't force you to use code behind, so why
> does
> > Visual Studio .Net? In Visual Studio .Net you can't even store the
code
> in
> > a DLL file and have it inherit from a particular class without VS
freaking
> > out when you try to load the .aspx or .ascx file into the editor. It's
> > VERY irritating.
> >
> > Chaitanya Marvici
> >
> >
> >
>
>
-
Re: VS.Net and Code Behind
Chaitanya,
I read your postings. The notice of "There is not a class associated with
that file, would you like to create one?" has to do with creating a code
behind class. And as Rick pointed out -- you are not required to do so.
You wrote, "My problem is not that VS doesn't let you use inline code or
storing the code in a DLL". I use code stored in a dll all the time (both
from the pages and from independant classes). You'll have to be sure that
the namespace that covers the dll code is accessible to the page.
By the way -- code behind produce a dll for the ASP project. Where as the
inline code on a page will not (I believe that is correct). However, I have
to admit to you that right now I'm doing ONLY code behind. I redender nothing
in the html window. Everything that I'm producing is in the dll. I have
also been using webform inheritance and inserting User Controls and everything
seems to work as it should.
Intellisense should work if your dll code is "seen" by way of the correct
namespace.
I think if you keep investigation all this should fall into place for you.
Keith
"Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote:
>I was wondering if anyone knows a way of changing Visual Studio .Net's
>behavior when dealing with code behind files, or perhaps explain in detail
>why MS forces you to use code behind. I personally do not like using code
>behind files. I would prefer to use inline coding or store the code for
a
>particular page in a DLL mainly to easily maintain the file structure of
an
>ASP.Net application. I haven't been able to locate a way to change this
>inside VS. MS Web Matrix doesn't force you to use code behind, so why
does
>Visual Studio .Net? In Visual Studio .Net you can't even store the code
in
>a DLL file and have it inherit from a particular class without VS freaking
>out when you try to load the .aspx or .ascx file into the editor. It's
>VERY irritating.
>
>Chaitanya Marvici
>
>
>
-
Re: VS.Net and Code Behind
"Keith Summers" <Keith@WorldSearchNetwork.com> wrote in message
news:3f16a1af$1@tnews.web.devx.com...
>
> Chaitanya,
>
> I read your postings. The notice of "There is not a class associated
with
> that file, would you like to create one?" has to do with creating a code
> behind class. And as Rick pointed out -- you are not required to do so.
I know that it has to do with creating a code behind class. That's the
whole problem. If you choose NO as an option, then you get a whole bunch of
errors that show up in the task list. Even when I have a class inside of a
VB file that is NOT a code behind file (IE. compiles to a seperate DLL.)
then it does the same thing. VS does not handle dealing with anything
besides code behind files gracefully. Now, I might be mistaken, and there
is an option that I can switch on/off that might allow it to deal with not
having a code behind file, but I haven't found it.
> You wrote, "My problem is not that VS doesn't let you use inline code or
> storing the code in a DLL". I use code stored in a dll all the time (both
> from the pages and from independant classes). You'll have to be sure that
> the namespace that covers the dll code is accessible to the page.
It is accessable to page. It all compiles just fine, but I can't store my
..ASPX or .ASCX files inside the project, because Visual Studio can't deal
with pages that do not have a direct <pagename>.aspx.vb file. I don't like
having all those extra files around in the directory. I don't even want to
have the resx files there either.
> By the way -- code behind produce a dll for the ASP project. Where as the
> inline code on a page will not (I believe that is correct). However, I
have
> to admit to you that right now I'm doing ONLY code behind. I redender
nothing
> in the html window. Everything that I'm producing is in the dll. I have
> also been using webform inheritance and inserting User Controls and
everything
> seems to work as it should.
Actually, you have to make sure that you specify which type of code behind
file that you are using. The VB files that are created by Visual studio
when you add a aspx page are not dealt with the same way as storing all of
the code for multiple pages in a single DLL. .Net itself handles this just
fine, but if there is not a single <pagename>.aspx.vb file for every single
aspx file, that's when VS starts doing the things that I DON'T want it to
do.
> Intellisense should work if your dll code is "seen" by way of the correct
> namespace.
Not when you use inline code. Give it a shot. I have not been able to get
intellisense to work if I am using ONLY inline code for an aspx page.
> I think if you keep investigation all this should fall into place for you.
I sure hope so. I don't think being forced to do stuff in a way that is not
condusive to maintaining a simple file structure. When you have 30 pages,
and 90 different files (1 aspx, 1 resx, and 1 aspx.vb for each file) just
for those pages, then another 3-5 files for the project all in the same
directory it gets REALLY hard to manage the files there. Due to the pages
that I work on and the large number of them, I do not relish the idea of
using code behind. (Note: I also don't like the fact that when you double
click on a file in the file manager, it takes you directly to the WYSIWYG
editor. Which is also subpar.) Do you know how to keep that from EVER
showing up?
Oh and don't even get me started on the Visual SourceSafe Integration with
VS. Those 2 products were NEVER designed to work together. I have lost
more code from VS hosing the VSS database than for any other reason.
Now don't get me wrong, I do like alot of the features of VS, but I just
wish that MS wouldn't force you to do things that you don't want to do.
But that's just me.
Chaitanya Marvici
>
>
>
> "Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote:
> >I was wondering if anyone knows a way of changing Visual Studio .Net's
> >behavior when dealing with code behind files, or perhaps explain in
detail
> >why MS forces you to use code behind. I personally do not like using
code
> >behind files. I would prefer to use inline coding or store the code for
> a
> >particular page in a DLL mainly to easily maintain the file structure of
> an
> >ASP.Net application. I haven't been able to locate a way to change this
> >inside VS. MS Web Matrix doesn't force you to use code behind, so why
> does
> >Visual Studio .Net? In Visual Studio .Net you can't even store the code
> in
> >a DLL file and have it inherit from a particular class without VS
freaking
> >out when you try to load the .aspx or .ascx file into the editor. It's
> >VERY irritating.
> >
> >Chaitanya Marvici
> >
> >
> >
>
-
Re: VS.Net and Code Behind
You know..... I have not tried to compile and use a project with out code
behind at this point, so you certainly are in territory that I know little
about .....
However, I think I have some new comments that may help you further.....
You wrote "I don't like having all those extra files around in the directory."
I'm assuming that you're talking about distribution here... You don't have
to send out all the files to your site. You distribute only the aspx files
and the .dll files. The aspx.vb and aspx.res files are for the working
project only (I believe that is the case for the res files).
You wrote "...but if there is not a single <pagename>.aspx.vb file for every
single aspx file, that's when VS starts doing the things that I DON'T want
it to do."
I see. I kind of go with the flow and keep a separate .vb file for each
aspx page.
"Not when you use inline code. Give it a shot. I have not been able to
get intellisense to work if I am using ONLY inline code for an aspx page."
I didn 't know that... hum... Ok. I'm real pro code-behind. Its what I
understand best.
You wrote, "(Note: I also don't like the fact that when you double
click on a file in the file manager, it takes you directly to the WYSIWYG
editor. Which is also subpar.) Do you know how to keep that from EVER
showing up?"
You know... I don't use the WYSIWYG editor for anything right now. Everything
I do is dyanmic... the down side is that it takes me twice a long to get
a page done. The upside it, that I have complete control over everything
on the page and my pages programmatically render themselves based on code.
Its a trade off for sure.
I haven't had any trouble with VSS the time that I used it. But it does
take some time getting use to. I don't use it currently.
I think you come from the other side of the tracks... Previously, I have
done little or no Web development. So, my thinking is in reverse. I approach
ASP.Net from a coding perspective and it's my comfort zone.
One thought for you... you could break down you 90 page project into smaller
sub-projects perhaps.
I tend to use a hierarchy of directories to simplify a project and I have
had some difficulties with cookie locations and accessing pages in other
directories. I've managed to get through them by accessing server path varibles
and such.
Anyhow, thanks for the comments. It all goes into "the hopper".
Keith
"Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote:
>"Keith Summers" <Keith@WorldSearchNetwork.com> wrote in message
>news:3f16a1af$1@tnews.web.devx.com...
>>
>> Chaitanya,
>>
>> I read your postings. The notice of "There is not a class associated
>with
>> that file, would you like to create one?" has to do with creating a code
>> behind class. And as Rick pointed out -- you are not required to do so.
>
>I know that it has to do with creating a code behind class. That's the
>whole problem. If you choose NO as an option, then you get a whole bunch
of
>errors that show up in the task list. Even when I have a class inside
of a
>VB file that is NOT a code behind file (IE. compiles to a seperate DLL.)
>then it does the same thing. VS does not handle dealing with anything
>besides code behind files gracefully. Now, I might be mistaken, and there
>is an option that I can switch on/off that might allow it to deal with not
>having a code behind file, but I haven't found it.
>
>> You wrote, "My problem is not that VS doesn't let you use inline code
or
>> storing the code in a DLL". I use code stored in a dll all the time (both
>> from the pages and from independant classes). You'll have to be sure
that
>> the namespace that covers the dll code is accessible to the page.
>
>It is accessable to page. It all compiles just fine, but I can't store
my
>..ASPX or .ASCX files inside the project, because Visual Studio can't deal
>with pages that do not have a direct <pagename>.aspx.vb file. I don't
like
>having all those extra files around in the directory. I don't even want
to
>have the resx files there either.
>
>> By the way -- code behind produce a dll for the ASP project. Where as
the
>> inline code on a page will not (I believe that is correct). However,
I
>have
>> to admit to you that right now I'm doing ONLY code behind. I redender
>nothing
>> in the html window. Everything that I'm producing is in the dll. I have
>> also been using webform inheritance and inserting User Controls and
>everything
>> seems to work as it should.
>
>Actually, you have to make sure that you specify which type of code behind
>file that you are using. The VB files that are created by Visual studio
>when you add a aspx page are not dealt with the same way as storing all
of
>the code for multiple pages in a single DLL. .Net itself handles this
just
>fine, but if there is not a single <pagename>.aspx.vb file for every single
>aspx file, that's when VS starts doing the things that I DON'T want it to
>do.
>
>
>> Intellisense should work if your dll code is "seen" by way of the correct
>> namespace.
>
>Not when you use inline code. Give it a shot. I have not been able to
get
>intellisense to work if I am using ONLY inline code for an aspx page.
>
>
>> I think if you keep investigation all this should fall into place for
you.
>
>I sure hope so. I don't think being forced to do stuff in a way that is
not
>condusive to maintaining a simple file structure. When you have 30 pages,
>and 90 different files (1 aspx, 1 resx, and 1 aspx.vb for each file) just
>for those pages, then another 3-5 files for the project all in the same
>directory it gets REALLY hard to manage the files there. Due to the pages
>that I work on and the large number of them, I do not relish the idea of
>using code behind. (Note: I also don't like the fact that when you double
>click on a file in the file manager, it takes you directly to the WYSIWYG
>editor. Which is also subpar.) Do you know how to keep that from EVER
>showing up?
>
>Oh and don't even get me started on the Visual SourceSafe Integration with
>VS. Those 2 products were NEVER designed to work together. I have lost
>more code from VS hosing the VSS database than for any other reason.
>
>Now don't get me wrong, I do like alot of the features of VS, but I just
>wish that MS wouldn't force you to do things that you don't want to do.
>But that's just me.
>
>Chaitanya Marvici
>
>
>>
>>
>>
>> "Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote:
>> >I was wondering if anyone knows a way of changing Visual Studio .Net's
>> >behavior when dealing with code behind files, or perhaps explain in
>detail
>> >why MS forces you to use code behind. I personally do not like using
>code
>> >behind files. I would prefer to use inline coding or store the code
for
>> a
>> >particular page in a DLL mainly to easily maintain the file structure
of
>> an
>> >ASP.Net application. I haven't been able to locate a way to change
this
>> >inside VS. MS Web Matrix doesn't force you to use code behind, so why
>> does
>> >Visual Studio .Net? In Visual Studio .Net you can't even store the
code
>> in
>> >a DLL file and have it inherit from a particular class without VS
>freaking
>> >out when you try to load the .aspx or .ascx file into the editor. It's
>> >VERY irritating.
>> >
>> >Chaitanya Marvici
>> >
>> >
>> >
>>
>
>
-
Re: VS.Net and Code Behind
Keith, thanks for your comments. I definately do come from the other side
of the tracks. I have been doing web developement (starting with HTML,
then moving to ASP, then to ASP.Net) for pretty much my entire career. So
I have certain ways that I like to develop the pages. One of those is
being able to generate the pages HTML by hand. I can create a very
specific page very quickly and easily to look exactly how I want to by
coding the HTML by hand. WYSIWYG editors have a tendancy to slow me down.
However, I do realize that isn't the norm. 
The .Net framework is probably some of MS's best work that I have seen to
date. It was very thought out and designed much more correctly than ASP
was. However, that being said, I can't stand the fact that MS also makes
you follow their way of doing some things in 1 piece of software, and making
that completely different in another piece of software. (IE. VS and
Matrix)
But then again, that's just one person's opinion. 
Have a nice day!
Chaitanya Marvici
"Keith Summers" <Keith@WorldSearchNetwork.com> wrote in message
news:3f19412d@tnews.web.devx.com...
>
> You know..... I have not tried to compile and use a project with out code
> behind at this point, so you certainly are in territory that I know little
> about .....
>
>
> However, I think I have some new comments that may help you further.....
>
> You wrote "I don't like having all those extra files around in the
directory."
> I'm assuming that you're talking about distribution here... You don't
have
> to send out all the files to your site. You distribute only the aspx
files
> and the .dll files. The aspx.vb and aspx.res files are for the working
> project only (I believe that is the case for the res files).
>
> You wrote "...but if there is not a single <pagename>.aspx.vb file for
every
> single aspx file, that's when VS starts doing the things that I DON'T want
> it to do."
>
> I see. I kind of go with the flow and keep a separate .vb file for each
> aspx page.
>
>
>
> "Not when you use inline code. Give it a shot. I have not been able to
> get intellisense to work if I am using ONLY inline code for an aspx page."
>
> I didn 't know that... hum... Ok. I'm real pro code-behind. Its what I
> understand best.
>
>
>
> You wrote, "(Note: I also don't like the fact that when you double
> click on a file in the file manager, it takes you directly to the WYSIWYG
> editor. Which is also subpar.) Do you know how to keep that from EVER
> showing up?"
>
> You know... I don't use the WYSIWYG editor for anything right now.
Everything
> I do is dyanmic... the down side is that it takes me twice a long to get
> a page done. The upside it, that I have complete control over everything
> on the page and my pages programmatically render themselves based on code.
> Its a trade off for sure.
>
>
> I haven't had any trouble with VSS the time that I used it. But it does
> take some time getting use to. I don't use it currently.
>
> I think you come from the other side of the tracks... Previously, I have
> done little or no Web development. So, my thinking is in reverse. I
approach
> ASP.Net from a coding perspective and it's my comfort zone.
>
> One thought for you... you could break down you 90 page project into
smaller
> sub-projects perhaps.
>
> I tend to use a hierarchy of directories to simplify a project and I have
> had some difficulties with cookie locations and accessing pages in other
> directories. I've managed to get through them by accessing server path
varibles
> and such.
>
> Anyhow, thanks for the comments. It all goes into "the hopper".
>
> Keith
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> "Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote:
> >"Keith Summers" <Keith@WorldSearchNetwork.com> wrote in message
> >news:3f16a1af$1@tnews.web.devx.com...
> >>
> >> Chaitanya,
> >>
> >> I read your postings. The notice of "There is not a class associated
> >with
> >> that file, would you like to create one?" has to do with creating a
code
> >> behind class. And as Rick pointed out -- you are not required to do
so.
> >
> >I know that it has to do with creating a code behind class. That's the
> >whole problem. If you choose NO as an option, then you get a whole bunch
> of
> >errors that show up in the task list. Even when I have a class inside
> of a
> >VB file that is NOT a code behind file (IE. compiles to a seperate DLL.)
> >then it does the same thing. VS does not handle dealing with anything
> >besides code behind files gracefully. Now, I might be mistaken, and
there
> >is an option that I can switch on/off that might allow it to deal with
not
> >having a code behind file, but I haven't found it.
> >
> >> You wrote, "My problem is not that VS doesn't let you use inline code
> or
> >> storing the code in a DLL". I use code stored in a dll all the time
(both
> >> from the pages and from independant classes). You'll have to be sure
> that
> >> the namespace that covers the dll code is accessible to the page.
> >
> >It is accessable to page. It all compiles just fine, but I can't store
> my
> >..ASPX or .ASCX files inside the project, because Visual Studio can't
deal
> >with pages that do not have a direct <pagename>.aspx.vb file. I don't
> like
> >having all those extra files around in the directory. I don't even want
> to
> >have the resx files there either.
> >
> >> By the way -- code behind produce a dll for the ASP project. Where as
> the
> >> inline code on a page will not (I believe that is correct). However,
> I
> >have
> >> to admit to you that right now I'm doing ONLY code behind. I redender
> >nothing
> >> in the html window. Everything that I'm producing is in the dll. I
have
> >> also been using webform inheritance and inserting User Controls and
> >everything
> >> seems to work as it should.
> >
> >Actually, you have to make sure that you specify which type of code
behind
> >file that you are using. The VB files that are created by Visual studio
> >when you add a aspx page are not dealt with the same way as storing all
> of
> >the code for multiple pages in a single DLL. .Net itself handles this
> just
> >fine, but if there is not a single <pagename>.aspx.vb file for every
single
> >aspx file, that's when VS starts doing the things that I DON'T want it to
> >do.
> >
> >
> >> Intellisense should work if your dll code is "seen" by way of the
correct
> >> namespace.
> >
> >Not when you use inline code. Give it a shot. I have not been able to
> get
> >intellisense to work if I am using ONLY inline code for an aspx page.
> >
> >
> >> I think if you keep investigation all this should fall into place for
> you.
> >
> >I sure hope so. I don't think being forced to do stuff in a way that is
> not
> >condusive to maintaining a simple file structure. When you have 30
pages,
> >and 90 different files (1 aspx, 1 resx, and 1 aspx.vb for each file) just
> >for those pages, then another 3-5 files for the project all in the same
> >directory it gets REALLY hard to manage the files there. Due to the
pages
> >that I work on and the large number of them, I do not relish the idea of
> >using code behind. (Note: I also don't like the fact that when you
double
> >click on a file in the file manager, it takes you directly to the WYSIWYG
> >editor. Which is also subpar.) Do you know how to keep that from EVER
> >showing up?
> >
> >Oh and don't even get me started on the Visual SourceSafe Integration
with
> >VS. Those 2 products were NEVER designed to work together. I have
lost
> >more code from VS hosing the VSS database than for any other reason.
> >
> >Now don't get me wrong, I do like alot of the features of VS, but I just
> >wish that MS wouldn't force you to do things that you don't want to do.
> >But that's just me.
> >
> >Chaitanya Marvici
> >
> >
> >>
> >>
> >>
> >> "Chaitanya Marvici" <chaitanya@bitmap-productions.com> wrote:
> >> >I was wondering if anyone knows a way of changing Visual Studio .Net's
> >> >behavior when dealing with code behind files, or perhaps explain in
> >detail
> >> >why MS forces you to use code behind. I personally do not like using
> >code
> >> >behind files. I would prefer to use inline coding or store the code
> for
> >> a
> >> >particular page in a DLL mainly to easily maintain the file structure
> of
> >> an
> >> >ASP.Net application. I haven't been able to locate a way to change
> this
> >> >inside VS. MS Web Matrix doesn't force you to use code behind, so
why
> >> does
> >> >Visual Studio .Net? In Visual Studio .Net you can't even store the
> code
> >> in
> >> >a DLL file and have it inherit from a particular class without VS
> >freaking
> >> >out when you try to load the .aspx or .ascx file into the editor.
It's
> >> >VERY irritating.
> >> >
> >> >Chaitanya Marvici
> >> >
> >> >
> >> >
> >>
> >
> >
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|