如果开启AutoGenerateSelectButton的话,点击该“选择”Button,则可以触发SelectedIndexChanged事件处理程序
但是如何实现点击gridview某行任何位置就触发一个后台事件呢?

解决方案 »

  1.   

    LZ考虑一下在客户端对GridView解析出来的Table有JS实现吧 比如JQuery
      

  2.   

    protected void gvMaster_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#cdebed'");
                e.Row.Attributes.Add("onmousedown", " if (c!='#cdebed'){b=c;this.style.backgroundColor='#cdebed';c='#cdebed'}else {c=b}");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
                
            }
        }
    其中 onmousedown 就是点击时的方法 
    不过页面可能需要定义一个 js  的b c变量
    其他事件可用JSjqGrid也可以实现