473,778 Members | 6,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET html-less pages

Hi,

I'm looking for samples of ASP.NET projects where the programming has been
done almost entirely using codebehind and classes with very little code in
the aspx files themselves.

I would like to be able to write ASP.NET pages where I represented the
elements on the page entirely with classes in codebehind (let's call them
RenderClasses). The idea would be that each of these classes would have a
Render method which would cause the appropriate html to be generated on
screen when it was called so that the visual element that the class instance
represented would be displayed in the browser.

So when the page loaded (in Page_Load), I would instantiate different types
of these RenderClasses, set their various properties and then I would call
their Render methods. Also, if I needed to change the appearance of the page
after user interaction, I would simply change the properties of these
instances in codebehind and then call the Render method. (Something like the
model-view-controller architecture.)

I know that the ASP.NET model has classes that derive from
System.Web.UI.C ontrol that represent many of the common elements we have in
forms. Would these classes do exactly what I want? Would it be possible for
me to have an aspx page which had no html at all, with the html being
generated by the Render methods? And very importantly, does anyone know of
any sample project that has been written using this technique? Are there any
potential pitfalls in terms of server processing?

Thanks in advance,

--
Akin

aknak at aksoto dot idps dot co dot uk

of these classes that would cause appropriate content to be displayed on
the browser. Also, if I needed to change the appearance of the page through
user interaction, I would change the properties of the class instances then
call the Render method
Nov 19 '05 #1
3 1437
Akin,

If you leave the ASPX page empty (no HTML), you can just use Response.Write
to output HTML.

Custom controls can use HTTPCurrentCont ext to output also when their Rended
method is invoked.

So you're Page_Load might look like:

.... C# ....
MyCustomerContr ol mc1 = new MyCustomControl 1();
mc1.SomePropert y = somevalue;
mc1.Render();
..........

There is also alot of alternatives you could do with this:
Instead of manually calling the control's Render method, you could add it as
a delegate for your Page's onRender event. I believe this is how it's done
when you use the standard WebControls.

I have a question on why you would want this? Is this to obscure the output?

Steve

"Epetruk" <no****@blackho le.com> wrote in message
news:36******** *****@individua l.net...
Hi,

I'm looking for samples of ASP.NET projects where the programming has been
done almost entirely using codebehind and classes with very little code in
the aspx files themselves.

I would like to be able to write ASP.NET pages where I represented the
elements on the page entirely with classes in codebehind (let's call them
RenderClasses). The idea would be that each of these classes would have a
Render method which would cause the appropriate html to be generated on
screen when it was called so that the visual element that the class instance represented would be displayed in the browser.

So when the page loaded (in Page_Load), I would instantiate different types of these RenderClasses, set their various properties and then I would call
their Render methods. Also, if I needed to change the appearance of the page after user interaction, I would simply change the properties of these
instances in codebehind and then call the Render method. (Something like the model-view-controller architecture.)

I know that the ASP.NET model has classes that derive from
System.Web.UI.C ontrol that represent many of the common elements we have in forms. Would these classes do exactly what I want? Would it be possible for me to have an aspx page which had no html at all, with the html being
generated by the Render methods? And very importantly, does anyone know of
any sample project that has been written using this technique? Are there any potential pitfalls in terms of server processing?

Thanks in advance,

--
Akin

aknak at aksoto dot idps dot co dot uk

of these classes that would cause appropriate content to be displayed on
the browser. Also, if I needed to change the appearance of the page through user interaction, I would change the properties of the class instances then call the Render method

Nov 19 '05 #2
Check out the HtmlTextWriter. AddAttribute(), .AddStyleAttrib ute(),
..RenderBeginTa g() and .RenderEndTag() methods and the HtmlTextWriterT ag and
HtmlTextWriterA ttribute enumerations on MSDN. They're great for creating
HTML in code.

If you really want to get into the nuts and bolts, check out the
IHttpHandler interface starting at
http://msdn.microsoft.com/library/de...tphandlers.asp.

HTH

DalePres
MCAD, MCDBA, MCSE

"Steve Lutz" <sl***@nospam.c omcast.net> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Akin,

If you leave the ASPX page empty (no HTML), you can just use
Response.Write
to output HTML.

Custom controls can use HTTPCurrentCont ext to output also when their
Rended
method is invoked.

So you're Page_Load might look like:

.... C# ....
MyCustomerContr ol mc1 = new MyCustomControl 1();
mc1.SomePropert y = somevalue;
mc1.Render();
..........

There is also alot of alternatives you could do with this:
Instead of manually calling the control's Render method, you could add it
as
a delegate for your Page's onRender event. I believe this is how it's done
when you use the standard WebControls.

I have a question on why you would want this? Is this to obscure the
output?

Steve

"Epetruk" <no****@blackho le.com> wrote in message
news:36******** *****@individua l.net...
Hi,

I'm looking for samples of ASP.NET projects where the programming has
been
done almost entirely using codebehind and classes with very little code
in
the aspx files themselves.

I would like to be able to write ASP.NET pages where I represented the
elements on the page entirely with classes in codebehind (let's call them
RenderClasses). The idea would be that each of these classes would have a
Render method which would cause the appropriate html to be generated on
screen when it was called so that the visual element that the class

instance
represented would be displayed in the browser.

So when the page loaded (in Page_Load), I would instantiate different

types
of these RenderClasses, set their various properties and then I would
call
their Render methods. Also, if I needed to change the appearance of the

page
after user interaction, I would simply change the properties of these
instances in codebehind and then call the Render method. (Something like

the
model-view-controller architecture.)

I know that the ASP.NET model has classes that derive from
System.Web.UI.C ontrol that represent many of the common elements we have

in
forms. Would these classes do exactly what I want? Would it be possible

for
me to have an aspx page which had no html at all, with the html being
generated by the Render methods? And very importantly, does anyone know
of
any sample project that has been written using this technique? Are there

any
potential pitfalls in terms of server processing?

Thanks in advance,

--
Akin

aknak at aksoto dot idps dot co dot uk

of these classes that would cause appropriate content to be displayed on
the browser. Also, if I needed to change the appearance of the page

through
user interaction, I would change the properties of the class instances

then
call the Render method


Nov 19 '05 #3
Steve Lutz wrote:
Akin,

If you leave the ASPX page empty (no HTML), you can just use
Response.Write to output HTML.

Custom controls can use HTTPCurrentCont ext to output also when their
Rended method is invoked.

So you're Page_Load might look like:

.... C# ....
MyCustomerContr ol mc1 = new MyCustomControl 1();
mc1.SomePropert y = somevalue;
mc1.Render();
..........

There is also alot of alternatives you could do with this:
Instead of manually calling the control's Render method, you could
add it as a delegate for your Page's onRender event. I believe this
is how it's done when you use the standard WebControls.

I have a question on why you would want this? Is this to obscure the
output?


Hi Steve,

Thanks for your answer.

To answer your question about why I would want to do this: well, coming from
a desktop software development background, I guess I'm more comfortable with
a model where the UI is entirely represented in a programming language like
VB or C#.

Cheers,

Akin
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8406
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties in JavaScript/JScript and HTML/XML elements. Without trying to get famous :-) but thinking it would be interesting to others I decided to post the following summary: 1. Variable names in JavaScript/JScript
4
2973
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text email by creating a text file, with content following certain format, and saving that file into the correct '..\mailroot\pickup' folder, and it is working fine
1
2423
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML GENERATED BY FUNCTION. Here'e the point: I'm writing a simple website for showing my photographs. It has a central page with many links (as many as galleries are).
33
4783
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show that happening. But if you look at it in Firefox you can see the small gap of white where the semi-circle image is broken. I've tried changing the background colors to gray in cells and tables
9
2006
by: Patient Guy | last post by:
Taking the BODY element as an example, all of its style attributes ('alink', 'vlink', 'background', 'text', etc.) are deprecated in HTML 4.01, a fact noted in the DOM Level 2 HTML specification. The DOM specification does not explicitly itself deprecate the use of attributes however for the element in the interface definition section I read. Is there text in the DOM specification that states specifically that the DOM specification...
9
6736
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP page, I want to grab a URL and parse /change the HTML and send it to the JSP page. I take the URL from the user in a textbox (not the
2
2151
by: lynx129 | last post by:
Hi there , I have php script that works fine under my server but I dont know how to put the html code inside my site. feedback.html <html dir="rtl"> <head> <title> ????? ??? </title> </head> <body>
7
3616
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference. http://www.marco.com.cn/web-content/marco_re10.html -------------------------------------------------------------- <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Marco</title> <!-- InstanceEndEditable -->
6
433
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9470
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7475
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2865
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.