gridview javascript返回错误的值

时间:2012-03-23 14:02:42

标签: javascript asp.net

在我的弹出页面上我有一个gridview,当客户端点击一行时,它将datakey发送到父页面

使用此javascript;

<script type="text/javascript">
    function Done(val) {
        window.returnValue = val;
        window.close();
    }
</script>

我在javascript代码上设置了一个断点,当我点击该行时,我看到gridview发送了真值,例如Done(02002),我在我的griview上看到了

但是当我看到脚本val = 1026如何发生这种情况时,我的页面上甚至没有像1026这样的值 多数民众赞成我如何将javascript添加到我的gridview

protected void grdSearch_RowDataBound(object sender, GridViewRowEventArgs e)
{
       if ((e.Row.RowType == DataControlRowType.DataRow))
       {
           //string dd = e.Row.Cells[0].Text;
          // ((Button)e.Row.FindControl("btnSec")).Attributes.Add("onclick", "Done(" >+ e.Row.Cells[0].Text + ")");
           e.Row.Attributes.Add("onclick", "Done(" + e.Row.Cells[0].Text + ")");
           e.Row.Attributes.Add("onmouseover", >"this.style.backgroundColor='#3f529c';this.style.color='#FFFFFF';this.style.cursor='pointe>r';");
           e.Row.Attributes.Add("onmouseout", >"this.style.backgroundColor='#FFFFFF';this.style.color='#3f529c'; ");
           string dd = e.Row.Cells[0].Text;
       }
 }

0 个答案:

没有答案