//obj当前点击的行(<tr onclick="GetCell(this)"><td></td>。。</tr>)
        function GetCell(obj)
        {
            $("#TextBox1").val($(obj).children().eq(0).text());//点击行的左边第1个cell
            $("#TextBox2").val($(obj).children().eq(1).text());;//点击行的左边第2个cell
            $("#TextBox3").val($(obj).children().eq(2).text());;//点击行的左边第3个cell
// .........................//点击行的左边第n个cell
        }

解决方案 »

  1.   

    1楼的代码我改成如下
     $(document).ready(function () {
                function GetCell(obj) {
                    $("#txtRoleid").val($(GridView1).children().eq(0).text()); //点击行的左边第1个cell               
                    // .........................//点击行的左边第n个cell
                }
            });
    点击没有什么反映,  我之前是用C#写的代码如下
      protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = GridView1.SelectedRow;
            this.txtRoleid.Text = row.Cells[0].Text;
            this.txtrolename.Text = row.Cells[1].Text;
            this.txtre.Text = row.Cells[2].Text;
        }
    高人能不能帮我用jquery再改一下, 非常感谢!
      

  2.   


    好久木有来逛了,刚刚看见,也许现在对你已经木什么作用了 function GetCell(obj) {}这里的obj只能是行(tr)对象。
    在<tr onclick='GetCell(this)'>......</tr>
    这样就木问题