Newbie: how to handle large response.write blocks

  • Thread starter Thread starter Brian F
  • Start date Start date
B

Brian F

Hi everyone -

Is there a way to abbreviate the aspx below? Specifically, is there a
way to eliminate the response.write syntax and escaped characters?

<%
if (MyObject.SomeBoolean)
{
Response.Write("<div class=\"myclass\">");
Response.Write("You may have won 1,000,000 dollars...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
else
{
Response.Write("<div class=\"error\">");
Response.Write("You should buy more magazines...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
%>

Thanks.
Brian
 
In C#, Not. If you want to have a literal quote in a string you have to place
the \ escape before it.

Regarding not having to type Response.Write so much, try stuffing all your
strings into a StringBuilder instance. At the end, you can write one time:
Response.Write(myStringBuilder.ToString());
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top