How to perform operation on edit in grid view in asp.net?

Nov 5 2009 12:30 AM

In my Grid view fileds like this:

 

BankName  Branch     AccNo   Balance  Edit   Delete

ICCi      bangalore  123     123     edit   delte

Sbi       hyd        1231   2312     edit    delete

 

Suppose I click Delete button the record will delete succesfully.

I can write like this:

--------------------------------------------------

cmd.Connection = conn;

        cmd.CommandText = "DELETE FROM bank WHERE bankId='" + ResultGridView.DataKeys[e.RowIndex].Values[0].ToString() + "'";       

        conn.Open();

        cmd.ExecuteNonQuery();

        conn.Close();

how can I do for below showing?

 

Suppose I click the Edit ,the corresponding data will show like this:

 

Bankname :sbi(web controls)

Branch    :hyd(same)

Accno      123(same)

Balance    123(same)


Answers (1)