目的:
1.在GridView中单击某行,该行变为 红色
2.双击某行弹出新页面,并且将该行的id传到新页面不用什么选择等按纽希望高手能贴点代码上来,谢谢!
我目前在上面的操作中,找了几个JS函数,但是传不出去ID值,想知道高手们怎么做的,一定要帮忙啊!!!

解决方案 »

  1.   

    1. protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onclick", "if(document.oldTr !=null){document.oldTr.runtimeStyle.cssText='';}this.runtimeStyle.cssText='background-color:red';document.oldTr=this;window.showModelessDialog('bb.aspx?id="+e.Row.Cells[0].Text+"');");
            }
        }
    2. 在Gridview中放个模板列,在其中放隐藏域,隐藏域存ID,双击时将隐藏域值传过去
      

  2.   

    隐藏域存ID  right
    e.Row.Cells[0].Visible = false;int id = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[0].Text);
      

  3.   

    我有一个这样的例子,
    给我发邮件,
    我给你
    [email protected]