checktb.Rows.Count
具估计应该是这个的问题

解决方案 »

  1.   

    不会吧,我alertchecktb.Rows.Count.ToString()显示就是为3呀
      

  2.   

    for语句是正确的
    checktb.Rows.Count有没有问题
    错误提示贴出来
      

  3.   

    没有提示,只增加了一行<tr>只在tr的第一个td里边的控件中打印了一个值,应该增加三行,在每行的第一个td里边打印我用(for int i=0;i<count;i++)
    {
    this.page.reg...alert('"+i.tostring()+'");
    }
    也只打印第一个"0"
    1,2都没有打印
      

  4.   

    int j=checktb.Rows.Count;
    for(int i=0;i<j;i++)
       // js的问题
      response.write("<script>alert(i.tostring())</script>");
    看看
      

  5.   

    Response.Write(i.tostring());
    能显示012这又能说明什么问题呢?
    this.page不是跟它一样的意思吗?换成this.Page.RegisterStartupScript("b","<script>cloneLine();document.all.tbody1.children["+i.ToString()+"].children[0].firstChild.value='"+checktb.Rows[i][0].ToString()+"'</script>");还是只能显示并打印一行,和一个td 的值
      

  6.   

    这是在下javascript的cloneLine()方法
    function cloneLine() //增加一行
    {
    var t = tbody1.children.length;
    var tmptr = tr1.cloneNode(true);
    tmptr.id=null
    tmptr.style.display="";
    tmptr.children[0].innerHTML = '<input id="yha" name="yha" size=6>';
    tmptr.children[1].innerHTML = '<input id="yhb" name="yhb" size=6>';
    tmptr.children[2].innerHTML = '<input id="yhc" name="yhc"  size=6>';
    tmptr.children[3].innerHTML = '<input id="yhd" name="yhd"  size=6>';
    tmptr.children[4].innerHTML = '<input id="yhe" name="yhe"  size=6>';
        tmptr.children[5].innerHTML = '<input id="yhf" name="yhf"  size=6>';
        tmptr.children[6].innerHTML = '<input id="yhg" name="yhg"  size=6>';
        tmptr.children[7].innerHTML = '<input id="yhh" name="yhh"  size=6>';
        tmptr.children[8].innerHTML = '<input id="yhi" name="yhi"  size=6>';
        tmptr.children[9].innerHTML = '<input id="yhj" name="yhj"  size=6>';
        tmptr.children[10].innerHTML = '<input id="yhk" name="yhk"  size=6>';
        tmptr.children[11].innerHTML = '<input id="yhl" name="yhl"  size=6>';
        tmptr.children[12].innerHTML = '<input id="yhm" name="yhm"  size=6>';
        tmptr.children[13].innerHTML = '<input id="yhn" name="yhn"  size=6>';
        tmptr.children[14].innerHTML = '<input id="yho" name="yho"  size=6>';
        tmptr.children[15].innerHTML = '<input id="yhp" name="yhp"  size=6>';
        tbody1.insertBefore(tmptr);
    }
      

  7.   

    循环体内的代码:
    this.Page.RegisterStartupScript("b","<script>cloneLine();document.all.tbody1.children["+i.ToString()+"].children[0].firstChild.value='"+checktb.Rows[i][0].ToString()+"'</script>");checktb.Rows.Count值为3,也就是你执行了3次RegisterStartupScript函数,这个函数的功能大概是为页面注册一个JS函数吧,但你连注3次且3次都名叫"b"???? 
    ASP会不会不高兴? 大概用个StringBuider 把这个JS写好之后,再用RegisterStartupScript调用一次吧?