Re: ASPX now with methods and classes
- From: "John Rivers" <first10@xxxxxxxxxxxxxx>
- Date: 26 Aug 2005 08:01:55 -0700
Dear Damien,
thankyou for your reply
please see my comments below ...
John
Damien wrote:
> John Rivers wrote:
> [an article about allowing you to fully intermingle code and html in
> ASP.NET]
>
> Personally, I've learnt to stop worrying and love the Code-Behind
> model. It's allowed me to do some things which are nigh-on impossible
> with the old ASP style intermingled pages.
>
> For instance, sometimes I have three completely differently laid out
> pages, which all use the same code-behind page for all of the complex
> code - they have the same controls but in completely different
> locations. But all of the application logic only exists once. Your
> alternatives with code-on-the-page are either:
>
> 1) A single monster page which has the control logic which determines
> which controls are produced and when spread over the whole page, or,
> 2) Three independent pages which then always have to be maintained in
> phase with each other when the application logic changes, or,
> 3) Three independent pages and a class which the pages call when they
> need the application logic to run - but then, you're inventing
> Code-behind.
my approach would enable you to do this:
create a re-usable class library for rendering
by letting you write full blown C# with codeblocks
so letting you use html literals, code completion etc.
let you write your three pages
and let them re-use the rendering code in the class library
whilst also letting you write complex dhtml/javascript apps
without this sort of kludge:
Response.Write(@"
<input type='button' onclick='
alert( ***read below );
'
");
***
do you see the problem here?
i can't use single quotes in the alert('hello'); method
because it will break the html single quotes
i have to use html single quotes
otherwise it breaks the C# double quotes
thus here are my choices:
the only way around this is to use "" instead of ' in the html
which means it isn't html literal anymore
the whole point in code blocks is to allow us to use html
unchanged
as codeblocks are just another syntax for response.write
it is ridiculous that we are prohibited from using them
in methods and classes
please somebody say you understand me!
i know i am right!
>
> And John, you've obviously never worked in a team where you have a
> seperate web page designer - who is very good at producing pretty
> webpages, but knows sod all about programming. The first time you
> realised the problem with intermingling is after they do an edit of the
> page, you get the latest version from source control and half of your
> code has been vanished.
>
> Damien
.
- Follow-Ups:
- Re: ASPX now with methods and classes
- From: John Horst
- Re: ASPX now with methods and classes
- References:
- ASPX now with methods and classes
- From: John Rivers
- Re: ASPX now with methods and classes
- From: Damien
- ASPX now with methods and classes
- Prev by Date: Re: Some Advice
- Next by Date: RE: Q: compare validator for date
- Previous by thread: Re: ASPX now with methods and classes
- Next by thread: Re: ASPX now with methods and classes
- Index(es):