ASP.NET Beginner Question
-
Hi all, I'm from an C++ and MFC background, and I'm just kind of messing around with ASP.NET using C#. I have lots of questions so far, but one in particular that I need to figure out before I get much further. What is the correct way to generate an HTML page? I've tried using Response.Write from Page_Load, but this puts my table before the starting tag. So I tried searching, and I found something saying that overriding Render was the correct way to do it. However, this leaves me with no tags at all. And I'm also interested in having a form created at design time, so I can't just output the complete HTML page ( tags and all) from Render. Can anybody help me please? All the examples I see on the web show how to do this using classic ASP style, where the code is mixed in the page, and I am loathe to do that. Thanks in Advance, Chris Richardson
-
Hi all, I'm from an C++ and MFC background, and I'm just kind of messing around with ASP.NET using C#. I have lots of questions so far, but one in particular that I need to figure out before I get much further. What is the correct way to generate an HTML page? I've tried using Response.Write from Page_Load, but this puts my table before the starting tag. So I tried searching, and I found something saying that overriding Render was the correct way to do it. However, this leaves me with no tags at all. And I'm also interested in having a form created at design time, so I can't just output the complete HTML page ( tags and all) from Render. Can anybody help me please? All the examples I see on the web show how to do this using classic ASP style, where the code is mixed in the page, and I am loathe to do that. Thanks in Advance, Chris Richardson
How do you mean generate an HTML page? Do you mean to create a page dynamically at runtime? If so, there are 2 ways I would do it: 1. Place a label on the web form at design time. The during runtime, assign the html tags into the label, like so:
label.Text ="........
";
2. You can use the framework to add the objects into the form.
TextBox txt = new TextBox();
txt.Id = "txt1";
//set other properties
Page.Controls.Add(txt);or something to that effect. Hope that helps
God, I pity me! - Phoncible P. Bone If I end up Windows ME someone is going to be hurting. - One of the answers to a question for What OS are you
-
How do you mean generate an HTML page? Do you mean to create a page dynamically at runtime? If so, there are 2 ways I would do it: 1. Place a label on the web form at design time. The during runtime, assign the html tags into the label, like so:
label.Text ="........
";
2. You can use the framework to add the objects into the form.
TextBox txt = new TextBox();
txt.Id = "txt1";
//set other properties
Page.Controls.Add(txt);or something to that effect. Hope that helps
God, I pity me! - Phoncible P. Bone If I end up Windows ME someone is going to be hurting. - One of the answers to a question for What OS are you
Nick Seng wrote: Place a label on the web form at design time. The during runtime, assign the html tags into the label Thanks a lot Nick, this is just what I needed :). As for number 2, what I meant was that I needed to output HTML after an existing form (that I put in at design time), and I was only able to put the HTML before the form, using Response.Write, or if I used the Render override, I could only output the entire HTML page (thus erasing my form). So, anyways, what you told me is exactly perfect, thanks again! :D Chris Richardson
-
Nick Seng wrote: Place a label on the web form at design time. The during runtime, assign the html tags into the label Thanks a lot Nick, this is just what I needed :). As for number 2, what I meant was that I needed to output HTML after an existing form (that I put in at design time), and I was only able to put the HTML before the form, using Response.Write, or if I used the Render override, I could only output the entire HTML page (thus erasing my form). So, anyways, what you told me is exactly perfect, thanks again! :D Chris Richardson