下面的代码是在CS上面获取当前信息行的 dg_railway_code一列的数据的代码?
string railway_code = jg_show_dg.Rows[e.RowIndex].Cells["dg_railway_code"].Value.ToString();
在BS上面怎么实现获得鼠标点击获得当前行的信息?

解决方案 »

  1.   

    你bs cs没搞清楚
    js可以获得
      

  2.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
      {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
      e.Row.Attributes.Add("OnClick", "ClickEvent('" + e.Row.Cells[1].Text + "')");
      }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
      {
      if (e.Row.RowIndex != -1)
      {
      e.Row.Attributes.Add("onclick", "test(" + e.Row.RowIndex + ")");
      }
      }
    function test(i) {
      var gv = document.getElementById("<%=GridView1.ClientID%>");
      var rowStr = "";
      var myRow = gv.rows(i+1);
    }