when first time click on delete button in datagriedview then delete row successfully again click on delete then no row delete or no action perform but why ....
same condition with edit button ...
how to solve this problem plz reply me ....
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 25, 2015, 2:57 AM EDT
Jitendra SharmaRank #3,268 · 439 reputationPosted Jun 25, 2015, 2:58 AM EDT
Jitendra SharmaRank #3,268 · 439 reputationPosted Jun 25, 2015, 2:59 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 25, 2015, 3:02 AM EDT
{
con = new SqlConnection(dbcon);
cmd = new SqlCommand("Delete from Emp where Empid=" + DataGrid1.DataKeys[e.Item.ItemIndex].ToString(), con);
con.Open();
int rows = cmd.ExecuteNonQuery();
if (rows > 0)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Deleted", "");
con.Close();
BindData();
}
}
Nilesh JadavRank #110 · 20.3K reputationPosted Jun 25, 2015, 3:16 AM EDT
Full tutorial:
http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 25, 2015, 3:33 AM EDT