I use following code to retrive the values from grid view to label
ds = autosql.ShowDatas("SELECT * FROM Fax_Tablename");
if (ds.Tables[0].Rows.Count > 0)
{
lbl_id.Text = ds.Tables[0].Rows[0]["cmid"].ToString();
}
den i selected the GridView1_RowDeleting command in grid view to delete the selected row
as query
delete from Fax_tablename where cid='" + lbl_id.Text + "' "
if i select the delete button in grid view it deletes the first value in database since i am using
ds.Tables[0].Rows.Count
but my problem is
i need to delete the selected row in grid view on clicking the delete button
waiting for ur responces
thanks in advance
regards,
gowtham
Sandeep ShekhawatPosted Jun 2, 2011, 6:44 AM
{
objpro.CourseId = Int32.Parse(grdcourse.DataKeys[e.RowIndex].Value.ToString());
i = objdata.DeleteSP(objpro.CourseId, "sp_deletecourse");
}
use DataKeyNames="course_id" property of gridview
and use checkbox in gridview and Delete Button on web form