我手动添加的删除代码,但是不起作用,不知为何?控件各属性如下:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        Width="700px" onrowdeleting="GridView1_RowDeleting">
                        <Columns>
                            <asp:BoundField DataField="id" HeaderText="编号" ReadOnly="True" Visible="False">                                
                                <ControlStyle Width="10px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="title" HeaderText="标题">
                                <ControlStyle Width="70px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="classname" HeaderText="所属分类">
                                <ControlStyle Width="40px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="shuoming" HeaderText="说明">
                                <ControlStyle Width="560px" />
                            </asp:BoundField>
                            <asp:CommandField HeaderText="删除"  ShowDeleteButton="True">
                                <ControlStyle Width="20px" />
                            </asp:CommandField>
                        </Columns>
                        <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
                        <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
                    </asp:GridView>
代码是//绑定控件
public void bindGridView(GridView gv, string sqlStr)
    {
        gv.DataSource = new Execsql().execSqlQry(sqlStr);
        gv.DataBind();    
    }
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            new DataBind().bindGridView(GridView1, "select * from Vw_1");
        }
    }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string sql;
        sql = "delete from product where id ='" + GridView1.Rows[e.RowIndex].Cells[0].Text.ToString() + "'";
        new Execsql().execSqlNoneQry(sql);        new DataBind().bindGridView(GridView1, "select * from Vw_1");
    }