In my web page I had Gridview. I am bind datas at runtime using databind() method.
Then I have delete and edit buttons on the grid. When i click the buttons the row is deleted or edited. how to do it
I am using following coding for load datas
Bindgrid()
connect.cnopen();
SqlDataAdapter da = new SqlDataAdapter("select ITEM,QTY,RATE,Amount FROM TempSales where Billno='" + TXTBILLNO.Text + "'", connect.cn());
DataSet ds=new DataSet();
da.Fill(ds);
GridView1.DataSource=ds;
GridView1.DataBind();
I give the following coding for delete Row but it is not working
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Label Control = (Label)GridView1.Rows[e.RowIndex].FindControl("ITEM");
connect.cnopen();
SqlCommand cmd = new SqlCommand("delete from Tempsales where Item='" + Control.Text + "'", connect.cn());
Bindgrid();
}