function ReKey(k)
        {
            window.document.getElementById('TextBox1').Value=k;
            alert(k);
        }
请问为什么textbox1得不值????

解决方案 »

  1.   

    k=window.document.getElementById('TextBox1').Value ;
    这样吧?
      

  2.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("ondblclick", "ReKey('" + e.Row.Cells[0].Text + "')");
            }
        }    <script type="text/javascript" language="javascript">
            function ReKey(k)
            {
                window.document.getElementById('TextBox1').value=k;
                //alert(k);
            }
        </script>这样子的,我想通过双击让TEXTBOX1来取得GRIDVIEW中的值?但是但传过来了,可是textbox1得不值?
      

  3.   


    window.document.getElementById('TextBox1').HTMLText=k
      

  4.   

    window.document.getElementById('TextBox1').HTMLText=k
    这也还是不行,我在window.document.getElementById('TextBox1').点都没有找到HTMLText属性value的属性也没有找到,我看别人都是这么写的,我为什么不行?
      

  5.   

    这很正常
    因为js无法操作textbox的viewstate
    传回服务器的textbox仍然是js没有更改以前的值
    建议给页面加一个html的hidden(不能用服务器的hiddenfield控件),并且给它加上id和runat="server"属性
    然后在前台用js 同时改变textbox和hidden的值,然后在后台直接取hidden的值就OK
      

  6.   

    确定e.Row.Cells[0].Text的值存在吗?   
      

  7.   

    document.getElementById("TextBox1").innerText = k;
      

  8.   

    window.document.getElementById('TextBox1').HTMLText=k 
    这也还是不行,我在window.document.getElementById('TextBox1').点都没有找到HTMLText属性value的属性也没有找到,我看别人都是这么写的,我为什么不行?
    -------------------------------------
    value是html属性
    在vs开发环境下用“.”是没有智能提示的
      

  9.   

    protected   void   GridView1_RowDataBound(object   sender,   GridViewRowEventArgs   e) 
            { 
                    if   (e.Row.RowType   ==   DataControlRowType.DataRow) 
                    { 
                            e.Row.Attributes.Add("ondblclick",   "ReKey('"   +   e.Row.Cells[0].Text   +   "')"); 
                    } 
            }         <script   type="text/javascript"   language="javascript"> 
                    function   ReKey(k) 
                    { 
                            window.document.getElementById('TextBox1').value=k; 
                            //alert(k); 
                    } 
            </script> 在上面这个过程中应该没有提交到服务吧?我是按照别人写的.这个过程也只是通过window.document对象在客户端来修改ID为TextBox1的控件的值?不明白....????
      

  10.   

    e.Row.Cells[0].Text的值存在,因为alert(k); 都能获得值?
      

  11.   

    都说什么那  没看明白
    window.document.getElementById('TextBox1').value=k;
    这个对吗? 你上面能找到控件 
    控件ID 不是ASP:TextBox的ID了把
      

  12.   

    document.getElementById('<%=TextBox1.ClientId%>').HTMLText=k 
      

  13.   

    8楼的牛哥,innerText属性为什么在VS平台中我点不出来呀,还有VALUE属性也点不来,我看别人都用这个Value这个来改值,我为什么用这个就改不了呀?
      

  14.   

    8楼的牛哥,innerText属性为什么在VS平台中我点不出来呀,还有VALUE属性也点不来,我看别人都用这个Value这个来改值,我为什么用这个就改不了呀?
    -----------------
    10楼不是已经告诉你了吗?