我在Drid的DataBound事件里写:
if (e.Item.ItemIndex > -1)
{
if (e.Item.Cells[6].Text.ToString() == "Url")
{
string strUrl = e.Item.Cells[3].Text.ToString();
e.Item.Cells[2].Text = "<a href=" + strUrl + " target='_blank'>" e.Item.Cells[3].Text.Trim() + "</a>";
}
e.Item.Cells[4].Text = e.Item.Cells[4].Text.Trim().Replace("<", "<");
e.Item.Cells[4].Text = e.Item.Cells[4].Text.Trim().Replace(">", ">"); }这样刚开始是没有问题的,但界面其他按钮只要一点击,item.cell[2]的内容就变成空白了,除非重新绑定一下GRID,我后台跟踪也没有跟踪出来,
想问一下是什么原因造成的.如何解决?
解决倒是想在page_load里再放一次绑定.但真不是个办法~~
if (e.Item.ItemIndex > -1)
{
if (e.Item.Cells[6].Text.ToString() == "Url")
{
string strUrl = e.Item.Cells[3].Text.ToString();
e.Item.Cells[2].Text = "<a href=" + strUrl + " target='_blank'>" e.Item.Cells[3].Text.Trim() + "</a>";
}
e.Item.Cells[4].Text = e.Item.Cells[4].Text.Trim().Replace("<", "<");
e.Item.Cells[4].Text = e.Item.Cells[4].Text.Trim().Replace(">", ">"); }这样刚开始是没有问题的,但界面其他按钮只要一点击,item.cell[2]的内容就变成空白了,除非重新绑定一下GRID,我后台跟踪也没有跟踪出来,
想问一下是什么原因造成的.如何解决?
解决倒是想在page_load里再放一次绑定.但真不是个办法~~
你可以得到数据集以后对数据进行DataBound的处理,
例如dataSet.tables(0).rows(0)(1).text="你要定义的值"
然后直接绑定,不使用DataBound事件,再绑定应该就好用了。
THS,一语点醒梦中人啊~~~呵...结贴~~