1
我想用c锋利的代码的RowDataBound部分页面像后面来填充GridView中单列多行的值:填充单列多行的值gridview的
Col1 Col6
a 1
a 2
a 3
a 4
我有改为
Col1 Col6
a 1
2
3
4
现在我想实现这个,请帮忙吗?
Col1 Col6
a 1 2 3 4
下面的代码有什么问题?
if (e.Row.Cells[0].Text == "" && e.Row.Cells[5].Text != "")
{
for (int a = 0; a<GridView1.Rows.Count; a++)
{
string s = GridView1.Rows[a].Cells[5].Text;
GridView1.Rows[e.Row.RowIndex - 1].Cells[5].Text += s;
}
}
我在做什么错误?
Cell[0] is Col1
Cell[5] is Col6
如何写保护无效的Page_Load代码(对象发件人,发送System.EventArgs) – user680865 2011-03-30 13:24:59
如何写在保护无效的Page_Load(对象发件人,发送System.EventArgs) – user680865 2011-03-30 13:26:43
@ user680865我不是确定你想要什么。你还没有发布任何你的数据,GridView是什么等等。我已经发布了基本步骤,需要到达你想要的地方。在绑定之前将数据排列成新的数据结构。然后将'GridView'绑定到这个新对象,这样网格根本就不需要做任何工作,除非按原样显示数据。 – Kelsey 2011-03-30 15:18:29