各位大侠、牛人们!请教个关于gridview的有关问题

各位大侠、牛人们!请教个关于gridview的问题
我希望通过单击gridview的某一行,来获取该行的数据!

也就是说,我想单击gridview的某一行(前提是不启用选择事件),然后该行变色并把该行所有字段的值赋给相应的文本框或者其他能显示数据的控件,然后通过对文本框的值得操作来改变数据库的数据!

希望能给个完整的实例!谢谢!使用sql数据库,DaTaSet数据源操作!

我在网上找了很多!都不没弄出来!
请各位大侠赐教!
谢谢!

------解决方案--------------------
楼主要的情况

有两种理解呀:

你在单击,是在刷新本面的情况下,还是不刷新本页的情况下 把该行所有字段的值赋给相应的文本框

第一种,是你点点击GridView中某一行回传的情况,
在后台实现
C# code


  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((Button)e.Row.FindControl("btn3")).CommandArgument = e.Row.RowIndex.ToString();
            ((Button)e.Row.FindControl("btn2")).CommandArgument = e.Row.RowIndex.ToString();
            ((Button)e.Row.FindControl("btn3")).CommandName = "btn3";


        } 
    }

------解决方案--------------------
文件名:default6.aspx
满意请结贴,有问题请继续提问,谢谢!

HTML code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs" Inherits="Default6" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
        &nbsp;Price:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>Quantity:<asp:TextBox
            ID="TextBox2" runat="server"></asp:TextBox>Sum:<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></div>
    </form>
    <script type="text/javascript">
    function $(sElmID){return document.getElementById(sElmID);}
    var isIe=window.navigator.appName.indexOf("Netscape") == -1?true:false;
    var oRows=$("<%=GridView1.ClientID %>").rows;
    function initRow_Click(){
        for(var i=1;i<oRows.length;++i){
            oRows[i].onclick=new Function("onRow_Click(this)");
        }
    }
    
    function onRow_Click(oSrc){
        for(var i=1;i<oRows.length;++i){
            oRows[i].style.background="";
        }
        oSrc.style.background="orange";
        var oCells=oSrc.getElementsByTagName("td");
        $("<%=TextBox1.ClientID %>").value=isIe?oCells[0].innerText:oCells[0].textContent;
        $("<%=TextBox2.ClientID %>").value=isIe?oCells[1].innerText:oCells[0].textContent;
        $("<%=TextBox3.ClientID %>").value=isIe?oCells[2].innerText:oCells[0].textContent;
    }
    initRow_Click();
    </script>
</body>
</html>

------解决方案--------------------
html:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" AllowSorting="true" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblid" runat="server" Text='<%#Eval("id").ToString()%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="checkbox1" runat="server" ToolTip='<%#Eval("id") %>'>