也就是说,我现在在页面上放一个DATAGRID不进行任何数据邦定,
我也生成N列N行。
N列生成没有问题,多回几个邦定列就是啦。可是N行非得要到数据里增提取。
请高位高手解答。十分感谢!!!!!!!!!!!!!
item1,item2,item2列
temp,temp0,temp1行
有没有什么解决办法啊。。
我也生成N列N行。
N列生成没有问题,多回几个邦定列就是啦。可是N行非得要到数据里增提取。
请高位高手解答。十分感谢!!!!!!!!!!!!!
item1,item2,item2列
temp,temp0,temp1行
有没有什么解决办法啊。。
<%@ Page Language="C#" AutoEventWireup="True" %> <html>
<head>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {
// Generate rows and cells.
int numrows = 3;
int numcells = 2;
for (int j=0; j<numrows; j++) {
TableRow r = new TableRow();
for (int i=0; i<numcells; i++) {
TableCell c = new TableCell();
c.Controls.Add(new LiteralControl("row " + j.ToString() + ", cell " + i.ToString()));
r.Cells.Add(c);
}
Table1.Rows.Add(r);
}
}
</script>
</head>
<body>
<h3>Table Example, constructed programmatically</h3>
<form runat=server>
<asp:Table id="Table1"
GridLines="Both"
HorizontalAlign="Center"
Font-Name="Verdana"
Font-Size="8pt"
CellPadding=15
CellSpacing=0
Runat="server"/>
</form>
</body>
</html>
到400多个,那怎么办啊。请师兄介绍还有没有其它的方法啊。
我是想做一个复杂的查询,从各个表中提出数据来。在DATAGRID中列出来。然后进行
合计,还有什么更好的控件呢???谢谢啦
新建行的话你要用:
DataRow dr=DataTable1.NewRow();
先在一张datatable里放数据添加行,然后再绑到datagrid里去~。
tempDataTable.Columns.Add(New DataColumn("item1"))
tempDataTable.Columns.Add(New DataColumn("item2"))
tempDataTable.Columns.Add(New DataColumn("item3"))
For i = 1 To 22
tempDataTable.Rows.Add(New Object() {"i", ""})
Next
DataGrid1.DataSource = tempDataTable
DataGrid1.DataBind()
DataGrid1.DataSource = tb
DataGrid1.DataBind()