如何自定义 gridview控件本身的button 事件???
<asp:GridView   ID= "grdv1 "   runat= "server "   AutoGenerateColumns= "False "    
 Width= "800px "   Height= "255px "   AllowPaging= "True "   AllowSorting= "True "   OnPageIndexChanging= "grdv1_PageIndexChanging "   >  
  <Columns>  
  <asp:ButtonField   ButtonType= "Button "   Text= "约定此课 "   CommandName= "oncl "   />  
  </Columns>  
  </asp:GridView>               
    public   void   oncl(Object   sender,   GridViewCommandEventArgs   E) 
             {    
                                     string   strconn=   ConfigurationSettings.AppSettings[ "ConnectionString "]; 
                                     SqlConnection   cn   =   new   SqlConnection(strconn); 
 ..............等等   数据库操作 
             }   
 但是点完gridview上的button后   事件无响应    
 我想做的是数据插入操作..所以   CommandName   没用SELECT   EDIT   UPDATE   属性   所以需要自定义 
 我直接用.net的gridview控件   然后加个button   列      想自定义gridview上的button   事件.... 
 请指点!!! 
------解决方案--------------------不是这样用的.
应该在gridview的 rowCommand事件中判断
e.CommandName ==  "oncl "
 
 然后添加代码
------解决方案--------------------如果你的需求是所有的  button 列响应同意个事件就可以这样做,你最好是在拖gridview控件时,编辑好cloumn,然后对button 列触发事件 
 然后在自动生成的事件代码中写入你的代码     
 如果button 列每一行响应不同的 事件,这个就必须是完全自定义事件了,或者在上一个情况下用索引来控制
------解决方案--------------------e.rowinder == cloumn【 "oncl "】所在行的索引 
 每一行响应不同的 事件,
------解决方案--------------------前台: 
  <asp:GridView ID= "GridView1 " runat= "server " OnRowCommand= "GridView1_RowCommand ">  
              <Columns>  
                  <asp:ButtonField ButtonType= "button " DataTextField= "test " CommandName= "oncl " />  
              </Columns>  
          </asp:GridView>    
 后台cs: 
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) 
     { 
         if (e.CommandName ==  "oncl ") 
         { 
         } 
     }
------解决方案-------------------- <asp:GridView ID= "GridView1 " runat= "server " OnRowCommand= "GridView1_RowCommand ">  
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
                                                            事件处理函数的名字