DataGrid控件通过预定义的属性和委派,没有包含双标题的特性
解决方案 »
- 未能加载类型“FredCK.FCKeditorV2.FileBrowser.Config”,在线等
- 我想根据年份来生成一个问号比如2011(0001)号
- 关于部分用户提交失败的问题
- ACCESS数据库不能使用存储过程,如何进行复杂操作
- ASP.NET直接打开文档,而不出现下载的提示,求教
- vs2005里文件-〉源代码管理-〉更改源代码管理打不开,出行错误………………
- 在.net中怎么把.bin格式的文件内容读取出来,希望有代码,急用啊
- 关于图形打印
- asp.net中的DataGrid控件的高难度显示问题!
- 请问如果有 10 万 条数据 该怎么查询,我一查询就出错
- 请问VS.NET中开发WEB应用程序的两个小问题
- 对时间类型字段的检索问题
或者能够接受分页在定上
你可以得到在footer 之下的那个page
Dim Tc1 As New TemplateColumn()
Dim checkbg As New Label()
Dim container As New Control()
container.Controls.Add(checkbg)
Tc1.ItemTemplate.InstantiateIn(container)
Me.DataGrid1.Columns.Add(Tc1)在 Tc1.ItemTemplate.InstantiateIn(container)
时候说对象没有引用到实例,为什么,谢谢?
请说详细点好么?加入模板要怎么加呢?
if (e.Item.ItemType==ListItemType.Footer)
{
tr=new TableRow();
td=new TableCell();
td.ColumnSpan=e.Item.Cells.Count;
td.Text="No2";
tr.Cells.Add(td);
DataGrid1.Item.Add(tr);
}嗯,没测试过的,你看看行不行把
另外:以下这个问题也是急需的,请各位也帮帮忙!定义模版列的时候 Label label=new Label();
Control con=new Control();
TemplateColumn tc=new TemplateColumn();
tc.ItemTemplate.InstantiateIn(con);
con.Controls.Add(label);
DataGrid1.Columns.Add(tc);在tc.ItemTemplate.InstantiateIn(con);时候说对象没有引用到实例
这样只是把一个二行五列的Table和到第一个单元格里,多出来的四个单元格怎么处理呢?//生成Table
private Table creat_table(int n)
{
Table table1=new Table();
for(int i=0;i<2;i++)
{
TableRow tr=new TableRow();
for(int j=0;j<5;j++)
{
TableCell td=new TableCell();
td.ColumnSpan=n;
td.Text="No"+i.ToString()+j.ToString();
tr.Cells.Add(td);
}
table1.Controls.Add(tr);
}
}private void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType==ListItemType.Footer)
{
e.Item.Cells[1].ColumnSpan=e.Item.Cells.Count;
e.Item.Cells[1].Controls.Add(creat_table(e.Item.Cells.Count));
}
}
e.Item.Cells[1].Controls.Add(creat_table(e.Item.Cells.Count));
for (int i = 2; i < e.Item.Cells.Count; i++)
e.Item.Cells.RemoveAt(2);
for (int i = 2; i < e.Item.Cells.Count; i++)
e.Item.Cells.RemoveAt(2);
for (int i = 2; i < e.Item.Cells.Count; i++)
e.Item.Cells.RemoveAt(2);
Response.Write(e.Item.Cells.Count.ToString()); //输出为4
只是需要注意的是,删除一个之后,后面的Cell的Index都会减1。