无法得到id

taylermail 2008-07-17 05:18:00
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex != -1)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#bfd4e6'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#efefef'");
string id = e.Row.Cells[1].Text;
e.Row.Attributes.Add("ondblclick", "window.open('2.asp?pipe_num="+id+"')");
}

}

无法得到id???????id为空?????
...全文
64 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hongqi162 2008-07-17
  • 打赏
  • 举报
回复
这是创建一个新的行
hongqi162 2008-07-17
  • 打赏
  • 举报
回复
你RowCreated的时候cell里面哪有值啊
lawbc 2008-07-17
  • 打赏
  • 举报
回复
好像找这个事件中都只有行没有数据的吧
accpyy 2008-07-17
  • 打赏
  • 举报
回复
加个判断试试
if(e.Row.RowType == DataControlRowType.DataRow)
{
   string id = e.Row.Cells[1].Text;
silentwins 2008-07-17
  • 打赏
  • 举报
回复
是不是有控件什么的,导致该Cell没有Text属性

110,825

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧