예제 #1
0
    protected void gridview_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row          = (GridViewRow)GridView1.Rows[e.RowIndex];
        Label       lblbook_id   = (Label)row.FindControl("lblbook_id");
        TextBox     txtbname     = (TextBox)row.FindControl("txtbname");
        TextBox     txtpub       = (TextBox)row.FindControl("txtpub");
        TextBox     txtedition   = (TextBox)row.FindControl("txtedition");
        TextBox     txtauthor    = (TextBox)row.FindControl("txtauthor");
        TextBox     txtsem       = (TextBox)row.FindControl("txtsem");
        TextBox     txtsub       = (TextBox)row.FindControl("txtsub");
        TextBox     txtqty       = (TextBox)row.FindControl("txtqty");
        TextBox     txtprice     = (TextBox)row.FindControl("txtprice");
        Label       lbltotal_amt = (Label)row.FindControl("lbltotal_amt");

        GridView1.EditIndex = -1;


        x.conopen();
        int i = Convert.ToInt32(txtqty.Text);
        int j = Convert.ToInt32(txtprice.Text);

        lbltotal_amt.Text = Convert.ToString(i * j);
        string edit;

        edit = "update book_mster set book_name='" + txtbname.Text + "'pub_name='" + txtpub.Text + "'edition='" + txtedition.Text + "'author_name='" + txtauthor.Text + "'sem='" + txtsem.Text + "'sub_name='" + txtsub.Text + "'qty ='" + txtqty.Text + "', total_amt='" + lbltotal_amt.Text + "' where book_id='" + lblbook_id.Text + "'";
        x.AddtoCartiud(edit);
        x.conclose();
        FillGrid();
        x.conopen();
        // string edit;
        edit = "update book_mster set price ='" + txtprice.Text + "' where book_id='" + lblbook_id.Text + "'";
        x.AddtoCartiud(edit);
        x.conclose();
        FillGrid();
    }