protected void gvShowOut_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //单击/双击 事件             e.Row.Attributes["ondblclick"] = String.Format("javascript:dbl_click=true;window.open('Leave.aspx?flowInId={0}&fI_H_ID={1}','_blank','height=540, width=750px, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');", gvShowOut.DataKeys[e.Row.RowIndex].Values["FlowIn_ID"].ToString(),gvShowOut.DataKeys[e.Row.RowIndex].Values["FI_H_ID"].ToString());            
e.Row.Attributes["title"] = "双击打开详细页面";    }
我第一个值得到了,就是第二个值无法得到。老是提示字符串格式不正确!请高手赐教.

解决方案 »

  1.   

    你gridview主键是什么呢,是  FlowIn_ID,FI_H_ID 吗
      

  2.   

    我把这两个值都放在DataKeyNames里面。FlowIn_ID,FI_H_ID分别是一个表的外键和主键。我需要传这两个值到下个页面。
      

  3.   

    可能是因为
    gvShowOut.DataKeys[e.Row.RowIndex].Values["FI_H_ID"]
    包含特殊字符,比如说 & < 等等
    需要调用 this.Page.Server.UrlEncode(gvShowOut.DataKeys[e.Row.RowIndex].Values["FI_H_ID"].ToString())
      

  4.   

      string param = Common.Encrypt.EncryptURL(this.DDLflow_no.SelectedValue + e.Row.Cells[0].Text + e.Row.Cells[1].Text);
                    e.Row.Cells[0].Attributes.Add("ondoubleclick", "location.href='../Preview/Preview.aspx?a=" + param + "';return false;");
    用 e.Row.Cells[1].Text,取值