问题描述
这是我的default.aspx代码(创建一个包含1行和2个单元格的表)
This is my default.aspx code(create a table with 1 row and 2 cells)
<div id="id1">
<table>
<tr>
<td>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="firstname"
DataValueField="firstname" AppendDataBoundItems="true" >
<asp:ListItem Text="All" Value="-1" />
</td>
<td>
<asp:Button ID="Button1" runat="server" BackColor="#E1E1E1"
Text="Display Report" onclick="Button1_Click" OnClientClick="html()" />
</td>
</tr>
</table>
</div>
这是我的default.aspx.cs代码.在这里,我使用stringbuilder动态创建了表.
This is my default.aspx.cs code..Here i ahve created dynamically table using stringbuilder..
StringBuilder strhtmlcontent = new StringBuilder();
//table starts
strhtmlcontent.Append("<table align="Center" style="background-color:#" border-collapse:collapse="" cellspacing="0" rules="all" border="1" width="100%" xmlns:border-collapse="#unknown"><th width="8%" bgcolor="#DFDFFF">FirstName</th><th width="10%" bgcolor="#DFDFFF">Product Name</th><th width="10%" bgcolor="#DFDFFF">Client Name</th><th width="10%" bgcolor="#DFDFFF">Amount</th><th width="10%" bgcolor="#DFDFFF">Activity Date</th>");
strhtmlcontent.Append("</table>");
//table Ends
当我运行项目时,在default.aspx页中创建的表低于动态创建的表.
这样的意思
//table1(使用stringbuilder动态使用)
下面
//table2(aspx页面上的静态页面)
但我想要...像这样
//table2(aspx页面上的静态页面)
下面
//table1(使用stringbuilder动态.)
谢谢
When i run the project.. table created in default.aspx page is below that of dynamically created table..
Means like this
//table1 (dynamic using stringbuilder)
below
//table2 (static on aspx page)
But i want...like this
//table2 (static on aspx page)
below
//table1 (dynamic using stringbuilder.)
thanks
推荐答案
<asp:literal id="litTable1" runat="server" xmlns:asp="#unknown" />
<table id="table1" ...="">
...
</table>
.cs:
.cs:
...
StringBuilder strhtmlcontent = new StringBuilder();
// build your table
litTable1.Text = strhtmlcontent;
这篇关于动态HTML表格与静态html表格重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!