 |
BOOK: Beginning ASP.NET 1.0  | This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

June 20th, 2004, 01:51 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
|
|
How I can send Html Iutput using Response.write()
i am encountered problem in using Response.Write("<div class="tc">");
how i can do it.
any one to guide me.
The error code is
Code:
Line 452: #line default
Line 453: #line hidden
Line 454: __output.Write("\r\n</body>\r\n</html>\r\n");
Line 455: }
Line 456:
Detailed Error
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Code:
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
winnt\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\24ef71c8\e4eefc8a\0vpjib1h.0.cs(454,27): error CS1519: Invalid token '(' in class, struct, or interface member declaration
winnt\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\24ef71c8\e4eefc8a\0vpjib1h.0.cs(457,9): error CS0116: A namespace does not directly contain members such as fields or methods
winnt\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\24ef71c8\e4eefc8a\0vpjib1h.0.cs(466,25): error CS1518: Expected class, delegate, enum, interface, or struct
winnt\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\24ef71c8\e4eefc8a\0vpjib1h.0.cs(470,1): error CS1022: Type or namespace definition, or end-of-file expected
Regards
__________________
YoOrD .
Beauty is not on the face
Beauty is on the heart
~~<<Ghibran Khalil>>~~
|
|

June 20th, 2004, 03:41 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
In C#, you can escape the " by adding a \. In VB.NET you can escape it by adding another quote:
Response.Write("<div class=\"tc\">");
Can I ask why you're using "old skool" Response.Write statements? In ASP.NET there are usually much cleaner ways to do things without using Response.Write.
For example, you could create a server side <div> tag which you can then "fill" with the text you want to display....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

June 20th, 2004, 09:47 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Quote:
quote:Originally posted by Imar
In C#, you can escape the " by adding a \. In VB.NET you can escape it by adding another quote:
Response.Write("<div class=\"tc\">");
Can I ask why you're using "old skool" Response.Write statements? In ASP.NET there are usually much cleaner ways to do things without using Response.Write.
For example, you could create a server side <div> tag which you can then "fill" with the text you want to display....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
Hi Imar Thanx 2 U .
Can i ask u what i do what u tell me about to "fill" the i am et confused.
tell me how i can do it by examples give me more knowledge :)
thanx In Advance To u and every one spend time to help people like me
|
|

June 21st, 2004, 03:11 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi yoord,
When you reply to a post, can you please not quote the entire message? Since the entire thread is displayed on this Web page, it's easy to see all posts made in that thread. By quoting the entire previous post, you're cluttering things up, IMO. Each post page has a Reply to this Topic link at the top and at the bottom of the page. If you click that link, you'll get an empty reply box, without the previous message.
Anyway, what you should do in ASP.NET is use the standard controls that are available. Need to display some text that looks like a label? Use a Label control. Need to display some random text? Use a PlaceHolder control or a server side <div>. If you use Response.Write, you can never be really sure where your output shows up, as it depends on the location of your code in the page's lifecycle. So, instead of Response.Write, try this (I am using a Label, a server side Div and a PlaceHolder control for demo purposes):
Code:
Markup:
<asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder>
<asp:label id="Label1" runat="server">Label</asp:label>
<div runat="server" id="Div1" />
Code Behind (declarations):
protected System.Web.UI.WebControls.PlaceHolder PlaceHolder1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.HtmlControls.HtmlGenericControl Div1;
Code Behind (setting the text):
PlaceHolder1.Controls.Add(new LiteralControl("Hi, I am text in a Placeholder"));
Label1.Text = "Hi, I am text in a Label";
Div1.InnerHtml = "Hi, I am text (or HTML) in a <strong>div</strong> control";
Using this technique, you can place your controls (the div, the placeholder, etc etc) anywhere on the page where you like. As an added benefit, you have programmatic access to them, so it's easy to change the color of the Label to Red, if you want for example.
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Bliss by Muse (Track 2 from the album: Origin of symmetry) What's This?
|
|
 |