Web Form formatting problem

  • Thread starter Thread starter Pierre Carter
  • Start date Start date
P

Pierre Carter

Hello,
I'm using Response.Write to write text dynamically to a form. My
problem is that the text sent to the page is not written at the top of
the page, even if all margins are set to zero. I always have a space
between the top of the frame and the start of the text. I already use
this method with Classic ASP forms using VBScript and I do not have this
problem. Does anybody have an idea on how to solve this issue because
it is very tiresome to have two different formats in the same Web
Application.

Here is a sample of the text I write:
Response.Write("<TABLE BORDER=" + "0" + " CELLSPACING=" + "0" + "
WIDTH=" + "500" + ">");
Response.Write("<TR><TD WIDTH=" + "180" + " VALIGN=" + "top" +
"><BR><FONT FACE=" + "Arial" + " SIZE=" +"4" +"><b>" + "Confirmation" +
"</b><BR><BR><TD></FONT></TR>" );
Response.Write("<TR><TD WIDTH=" + "180" + "><FONT FACE=" + "Verdana,
Arial" + " SIZE=" + "2" + ">Status:</FONT></TD>" + "<TD><FONT FACE=" +
"Verdana, Arial" + " SIZE=" + "2" + ">Transaction Completed
Successfully" + "</FONT></TD></TR>" );
Response.Write( "</TABLE" );
Thank you very much for your ideas.
Pete
 
I believe your problem is that you are using response.write within an aspx page, which is usually a no-no when creating an html page.

Realize that the rendered html sent to the browser is probably going to place this table above the <html> tag, which is against any html standard written.

<table>....</table>
<html>

Forget you ever knew ASP, and start fresh and learn how to access this table from a script block or codebehind. ASP.net is nothing like ASP, your best bet is to find tutorials out there that explain the difference, and how best to approach migrating to it.

--Michael
 
You can use this inelegant approach <g>. In your code-behind, write a
Protected Function which emits the HTML you want. In your .aspx page, put a
call to it: <%=MyFunction %> at the place where you want the HTML to appear.
 
Back
Top