在一个页面上建一个datagrid表不做任何数据库连接,但又可以浏览出表头来?
解决方案 »
- 有知道怎么设置无图片时,给个默认的图片。不想要X的。
- iframe遮住里面的div内table提示框
- 开发过SAP 或者搞过相关开发的朋友,请进来帮我个忙,有个很棘手的问题
- 请问/和../和~/有什么区别
- Web打印预览的问题
- 自动生成file field控件..
- 想利用.net做个服务程序来发送和接收短信——通过短信猫
- ASP.NET源码
- 新手小白问个CodeBehind的粗浅问题
- 关于页面跳转后再返回原页面的问题
- 同样用一个C#开发的DLL,为什么Windowsapplication可以正常访问,而webapplication就不可以
- 提问一下,关于载入DATAGRID中各个事件的执行顺序的问题
在DataGrid的ItemCreated事件里面定义:
代码如下:if ( e.Item.ItemType == ListItemType.Header )
{
TableCellCollection tcl = e.Item.Cells;//获得表头元素的实例
tcl.Clear();//清除原有控件表头 DataGridItem dgi = new DataGridItem(0,-1,ListItemType.Header);
DataGridItem dgi1= new DataGridItem(0,-1,ListItemType.Header);
Table tb = new Table();
tb = (Table)DataGrid1.Controls[0];
tb.Rows.AddAt(0,dgi);
tb.Rows.AddAt(1,dgi1);
TableCell tc11 = new TableCell();
TableCell tc12 = new TableCell();
TableCell tc13 = new TableCell();
TableCell tc21 = new TableCell();
TableCell tc22 = new TableCell();
TableCell tc23 = new TableCell();
TableCell tc24 = new TableCell();
TableCell tc25 = new TableCell();
tc11.Text = "11";
tc11.ColumnSpan = 1;
tcl1.RowSpan = 2;
dgi.Cells.Add(tc11); tc12.Text = "12";
tc12.ColumnSpan = 3;
dgi.Cells.Add(tc12); tc13.Text = "13";
tc13.ColumnSpan = 2;
dgi.Cells.Add(tc13); tc21.Text = "21";
tc21.ColumnSpan = 1;
dgi1.Cells.Add(tc21); tc22.Text = "22";
tc22.ColumnSpan = 1;
dgi1.Cells.Add(tc22);
//
tc23.Text = "23";
tc23.ColumnSpan = 1;
dgi1.Cells.Add(tc23);
//
tc24.Text = "24";
tc24.ColumnSpan = 1;
dgi1.Cells.Add(tc24); tc25.Text = "25";
tc25.ColumnSpan = 1;
dgi1.Cells.Add(tc25);
}
dt.Columns.Add(...)
.....
....