这个该怎么样处理呢?给一段代码,结帖率100%.

解决方案 »

  1.   

    没有双击事件,只能通过其它方式实现,在gridview的行单击事件中增加一个计数器,目的就是判断用户单击次数,没当计数器增加到2便执行次单击事件,计数器清0,这个有个漏洞就是两次单击的时间间隔问题。对于这种蛋疼的问题想不出其他的解决方法了。
      

  2.   

    确实没有双击事件,要不LZ可否用编辑事件  Public void CustomersGridView_RowEditing(Object sender, GridViewEditEventArgs e)
      {
        String message = CustomersGridView.Rows[e.NewEditIndex].Cells["你要的单元格控件"].Text;
        MessageBox.Show(message);
      }
      

  3.   

     不是太明白你的意思,你是要双击gridview某行获取行号?protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
           if (e.Row.RowType == DataControlRowType.DataRow)
           {
               e.Row.Attributes.Add("ondblclick", "alert('"+e.Row.RowIndex+1+"')");
           }
        }
      

  4.   

    后台代码 public partial class TestDoubleclick : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                List<Student> studentList = new List<Student>() { 
                
                    new Student(){ ID=1, Name="wang"},
                    new Student(){ ID=2, Name="symbol"}
                };            this.GridView1.DataSource = studentList;            this.GridView1.DataKeyNames = new string[] { "ID"};            this.GridView1.DataBind();            foreach (GridViewRow gvr in this.GridView1.Rows)
                {
                    gvr.Attributes.Add("ondblclick", "alert('"+ gvr.RowIndex +"');");
                }
                
            }    }    public class Student
        {
            public int ID { set; get; }        public string Name { set; get; }
        }
    前台就是gridview
        <form id="form1" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server">
            </asp:GridView>
        </div>
        </form>
    取值返回的部分就ajax吧,这个楼主自己决定用什么框架
      

  5.   


    protected void gvProject_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
    //鼠标移上变色,离开白色
                    e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
                    e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");                //设置悬浮鼠标指针形状为"小手"   
                    e.Row.Attributes["style"] = "Cursor:hand";   
    //点击取值,并返回父窗口
                    e.Row.Attributes.Add("onclick", "parent.set_Project(\"" + e.Row.Cells[1].Text + "\",\"" + e.Row.Cells[0].Text + "\");parent.close1();");
                }
            }
    紧供参考
      

  6.   

    兄弟,,这个是啥子意思?"parent.set_Project
      

  7.   

    zmcici      "parent.set_Project这个是啥子,用来做啥子用的,给一个完整的代码。。
      

  8.   

    http://www.codeproject.com/KB/webforms/DoubleClickGridviewRow.aspx这个!不过是英文的,下载源码来研究下就明白了
      

  9.   

    parent.set_Project()这个是调用父页的JS方法,里面的参数是回传过去的,你要回传几个就写几个参数;parent.close1()是关闭弹出的层
      

  10.   

    很简单的,可以通添加双击属性!protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
              //假设你要获取当前行第一列的值!
                e.Row.Attributes.Add("ondblclick","alert('"+e.Row.Cells[0].Text.ToString()+"')");         }
        }