473,769 Members | 3,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to render a page

Hi,

I need to render my site for html 3.2 so I ran into to Html32TextWrite r and
managed to render some usercontrols but how do you create an actual page?

In the default.aspx I tried to create my login page like this.

protected void Page_Load(objec t sender, EventArgs e)
{
rendered = new StringBuilder() ;
this.LoginMainT est1 = new _LoginMainTest( );
System.IO.TextW riter txtwriter = new System.IO.Strin gWriter(rendere d);
Html32TextWrite r html32writer = new Html32TextWrite r(txtwriter);
Page pg = new Page();
pg.Controls.Add (this.LoginMain Test1);
pg.RenderContro l(html32writer) ;
//.......
}

this gives an error 'Request is not available in this context' on
pg.RenderContro l(html32writer) ; so does anyone got a nice "Hello world"
example on how to make such a page?
Sep 1 '06 #1
2 2991
Hello Heron,

"Heron" <no****@nospam. comwrote in message
news:ev******** *****@TK2MSFTNG P03.phx.gbl...
Hi,

I need to render my site for html 3.2 so I ran into to Html32TextWrite r
and managed to render some usercontrols but how do you create an actual
page?

In the default.aspx I tried to create my login page like this.

protected void Page_Load(objec t sender, EventArgs e)
{
rendered = new StringBuilder() ;
this.LoginMainT est1 = new _LoginMainTest( );
System.IO.TextW riter txtwriter = new System.IO.Strin gWriter(rendere d);
Html32TextWrite r html32writer = new Html32TextWrite r(txtwriter);
Page pg = new Page();
Don't do that. You already have a page. Try "this.Page" , you'll see...
pg.Controls.Add (this.LoginMain Test1);
Add the control to a Form that has the Attribute runat=server.
pg.RenderContro l(html32writer) ;
You don't need to call this manually!

Bye,

--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers
Sep 1 '06 #2
hmm, tried it several ways now and i still fail to get it validated for html
3.2.

My current page looks like this but it's not working like you can see at
http://validator.w3.org/check?uri=ht...ctype=HTML+3.2

<%@ Page Language="C#" %>
<%@ Register Src="Controls/LoginMainTest.a scx" TagName="LoginM ainTest"
TagPrefix="uc1" %>
<script runat="server">
protected override HtmlTextWriter
CreateHtmlTextW riter(System.IO .TextWriter writer)
{
return new Html32TextWrite r(writer);
}
</script>
<html>
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:LoginMainT est ID="LoginMainTe st1" runat="server" />
</div>
</form>
</body>
</html>
"Matthias Pieroth" <pi*********@ya hoo.deschreef in bericht
news:ed******** *****@news.t-online.com...
Hello Heron,

"Heron" <no****@nospam. comwrote in message
news:ev******** *****@TK2MSFTNG P03.phx.gbl...
>Hi,

I need to render my site for html 3.2 so I ran into to Html32TextWrite r
and managed to render some usercontrols but how do you create an actual
page?

In the default.aspx I tried to create my login page like this.

protected void Page_Load(objec t sender, EventArgs e)
{
rendered = new StringBuilder() ;
this.LoginMainT est1 = new _LoginMainTest( );
System.IO.TextW riter txtwriter = new System.IO.Strin gWriter(rendere d);
Html32TextWrite r html32writer = new Html32TextWrite r(txtwriter);
Page pg = new Page();

Don't do that. You already have a page. Try "this.Page" , you'll see...
> pg.Controls.Add (this.LoginMain Test1);

Add the control to a Form that has the Attribute runat=server.
> pg.RenderContro l(html32writer) ;

You don't need to call this manually!

Bye,

--
Matthias Pieroth
www.codegod.de - The Page for .NET-developers

Sep 1 '06 #3

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

Similar topics

1
2174
by: Tomas | last post by:
Is there any sequence diagram on the web that clearly shows in which order all Page methods (load, render and so on) are being called compared to the order the page's contained control methods are being called by the asp.net enginge ??? To be more specific, the thing I currently am most interested in understanding is from which method in the Page class you can know that that the Render method of all aggregated controls have been called...
2
1322
by: Andrea Williams | last post by:
I have a form where the user chooses reporting options and when submit is clicked, I need to present them with dynamically created excel file. In Classic ASP I would just change the viewing options, but in ASP.NET I'm using code-behind. Is there a way to clear what is scheduled to be renedered and write new information into the page render? OR Should I Server.Transfer to a different page that renders the correct info?
4
4220
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where the server generates the HTML based on a passed in parameter. In our case, CustomerID. Every Customer ges a branded website with there logos and webpage etc.. To Avoid having 1 ASP.Net application running for each client I am attempting a more...
5
1784
by: sk | last post by:
Hi, I'm trying to override the Render method of my Page class. Are there any standard guidelines for this? Thanks. Shardul
2
1599
by: Tony | last post by:
I have a very peculiar problem that I am hoping someone can point me in the right direction on. I have an asp.net page that displays a virtual paycheck to a user. One asp.net page calls another that has its return type as a jpeg. This jpeg is an image of a paycheck that is written on top of with the appropriate information. The code runs fine on all of our development machines as well as our test server. But on our live server it...
3
5170
by: John Hughes | last post by:
I'm trying to add a user control to a form via the pages render method and I get the following error : "Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server" The user control has this button on its page. I am outputing the <form runat="server"> inside the render method and have also tried adding it to the page and to the control without any luck. Any help appreciated.
1
4110
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem: I dynamically add an htmlcheckbox to a webform in the pages render and set the checked value to true. When the page loads, if I remove the check from the checkbox and then submit it, in the submit event the checkbox' checked value is still...
0
1029
by: Raghu | last post by:
Hi All, I am building Report application using ASP.Net and C#. The report will be shown to the user in aspx page. The report inputs are taken at runtime like columns user wants to see and filters user wants to be applied. I am using Analysis Services 2000 to get data. Basically it uses OLAP database to get the data. There are performance issues both at OLAP level and ASP.Net.
13
3559
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains some javascript code that calls window.open. I pass the resource url of page B to Page A's window.open call. Page B is then loaded and executed but none of the server-side code is rendered. If I view the source of the page, the code (and page...
2
1477
by: Just Me | last post by:
Does anyone know if one can get to a representation of the rendered page ( after ) render. ?
0
9420
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
10201
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
10035
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...
1
9982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
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
2
3554
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.