我想实现GridView单击行事件  界面是上面都是文本框 下面是GridView 当单击GridView某一行的时候 通过自己写的findbyID方法获得整条记录信息(GridView未将全部列显示)现在 方法写了 不知道在那条事件里调用 看到网上说的都用JS实现 可是我的方法不是JS得啊
方法在下面 哪位大侠指点一下啊
 protected void FindMessage(string ID) 
    {
        DataTable ta = DBhelper.FindAllByID("a1", "a2", a2).Tables[0];
        if (ta.Rows.Count>0)
        {
            a1.Text = ta.Rows[0]["a1"].ToString();
            a2.Text = ta.Rows[0]["a2"].ToString();
          
        }
    }}

解决方案 »

  1.   

    你点进SelectedIndexChange事件中,
    通过int rowIndex=GridView.SelectedIndex; 
    string data=GridView.Row[rowIndex]["列名"].ToString();//如此就可以取得当行某列信息
    //调你的信息
      

  2.   

    这不是BS用的吧 好像是CS用的
      

  3.   

    BS里只有GridView1_SelectedIndexChanged GridView1_SelectedIndexChanging 我放到里面都不调用 设断点 都不进去的
      

  4.   

    用GridView1_SelectedIndexChanged,
    你的网页AutoEventWireup="true" ?
    如果为false设为true
      

  5.   

    有這個事件,AutoEventWireup="true"沒道理進不去啊,我做的都可以的.
      

  6.   

    设完了 还是不进去   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoEventWireup="true" 
                    onrowcreated="GridView1_RowCreated" onrowdatabound="GridView1_RowDataBound" 
                    Width="100%" AllowPaging="True" 
                    onpageindexchanging="GridView1_PageIndexChanging" 
                    onselectedindexchanged="GridView1_SelectedIndexChanged">
      

  7.   

    AutoEventWireup="true"  我用提示的方法都没有 我就直接写上去了 结果还是调不到