日期:2014-05-18 浏览次数:20471 次
//DataSet ds = new DataSet(); //默认是private public DataSet ds = new DataSet();
------解决方案--------------------
LS的回答正确了,不过建议LZ不要这样写,<table id="table11" border ="0" runat ="server">
<tr>
<td valign ="top" style="height: 18px">
<%
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Label[] lbl = new Label[10];
lbl[i] = new Label();
lbl[i].Text = ds.Tables[0].Rows[i]["FunctionName"].ToString() ;
this.Page.Controls.Add(lbl[i]);
}
%>
</p>
</td>
</tr>
</table>
-----------------------------------------------------------
这段我觉得改为
<table id="table11" border ="0"
<tr>
<td valign ="top" style="height: 18px" runat ="server"> id="td1">
</td>
</tr>
</table>
后台用StringBuilder来构造下面这段,然后用td1.InnerHTML = "";这样方式比较好
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Label[] lbl = new Label[10];
lbl[i] = new Label();
lbl[i].Text = ds.Tables[0].Rows[i]["FunctionName"].ToString() ;
this.Page.Controls.Add(lbl[i]);
}
------解决方案--------------------