473,388 Members | 1,256 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

About Response.Write problem

Yiu
Below is my code:
for(int cnt=info.count;cnt>0;cnt--)
{
label[cnt-1]=new Label();
label[cnt-1].Text=(String)info[cnt-1];
Page.Controls.Add(label[cnt-1]);
page.response.write("<tr><td>&nbsp;</td></tr>");
}

But have something wrong in the output, the <tr><td>&nbsp;</td></tr>
not print between the label, it print at the head of the HTML.Why?Have
solution?
<span>free</span><span>science museum</span> is my Label output.

Below is my HTML output after add Label use the code above:
<tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>showinformation</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="generator">
<meta content="C#" name="code_language">
<meta content="JavaScript" name="vs_defaultclientscript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetschema">
</head>
<body ms_positioning="gridlayout">
<form name="Form1" method="post" action="ShowInformation.aspx"
id="form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwtNTMwNzcxMzI0Ozs+XUGdiuz4iPEe85152UYL3O0 Fa+A=" />

<FONT face="新細明體">
<input type="submit" name="BackButton" value="Back"
id="BackButton" style="height:32px;width:64px;Z-INDEX: 101; LEFT:
24px; POSITION: absolute; TOP: 288px" /></font></form>
</body>
</html>
<span>free</span><span>science museum</span>
Nov 18 '05 #1
1 1293
Try this:

Add an ASP table to your form in design mode like this...

<asp:Table id="Table1" runat="server"></asp:Table>

....and then add the following code to the Page_Load. It's not the most
efficient/elegant code but it will do what I think you want it to do.

for (int row = 1; row <= 5; row++)
{
// Add menu item
TableRow tableRow = new TableRow();
TableCell tableCell = new TableCell();
Label label = new Label();
label.Text = "menu item";
tableCell.Controls.Add(label);
tableRow.Controls.Add(tableCell);
Table1.Controls.Add(tableRow);

// Add spacer
TableRow tableRowSpacer = new TableRow();
TableCell tableCellSpacer = new TableCell();
Label labelSpacer = new Label();
labelSpacer.Text = "&nbsp;";
tableCellSpacer.Controls.Add(labelSpacer);
tableRowSpacer.Controls.Add(tableCellSpacer);
Table1.Controls.Add(tableRowSpacer);
}
Nov 18 '05 #2

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

Similar topics

3
by: Gary | last post by:
I am having a strange problem that I cannot solve. I have an asp page that I use for a user to login and gain access to other pages. When the user logs in I set a couple of session variables like...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
11
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
3
by: Brad | last post by:
I have a response filter which injects "standard" html into my pages. The filter works fine when the initial stream is small enough not to buffer...or....if I have a large unbuffered stream (i.e. I...
5
by: matthew | last post by:
Hi all, I am now writing a aspx that get a session variable (string) and then write it out using Response.Write. The string length is: 494710. But Response.Write only write the string...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
6
by: SK | last post by:
Hello, I have a datagrid, textbox and a button in my page. The datagtrid has sorting enabled. But, I am not doing any sorting. Its just for test purpose. Now the user enteres some text in the...
17
by: raj chahal | last post by:
Hi there I need to be able to print on screen when I check if a value within a db <td> <% if ((Recordset1.Fields.Item("profile1").Value) <> "") then response.Write"Pro1<br>" &...
4
by: lucavilla | last post by:
If you go to http://europe.nokia.com/A4305060, fill the "Enter your product code:" field with the value "0523183" and press "Go" (the ending page URL varies because there's a variable session-ID in...
22
by: Neil Gould | last post by:
Or... when is a script not a script? I have several modules for managing different aspects of our club's website, most of which are multi-page. Does setting such things as server.ScriptTimeout...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
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...

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.