I am trying to delete selected link on gridview on base of two table id is equal when the id is equal then that link is remove or not
we have column on gridview is id, Description and date and i want to delete selected id link which is available in other table we are match both table id
how to remove row on grid view
Romove linkbutton on gridview
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Renish Patel160 reputationPosted May 31, 2013, 3:55 AM EDT
and on row command event of gridview use as below
protected void rowcommand(object sender, GridViewCommandEventArgs e)
{
try
{
Int32 id = Convert.ToInt32(e.CommandArgument);
string comm = "Delete from tblComments where id=@id";
SqlCommand cmd = new SqlCommand(comm, Db.GetConnection()); cmd.Parameters.AddWithValue("id", id);
cmd.ExecuteNonQuery();
GridView1.DataBind();
}
catch (Exception ex)
{
}
}
It solve your problems,make as answered if your problem is solved
Thanks
Happy Coding...
Renish Patel160 reputationPosted Jun 3, 2013, 3:38 AM EDT
Thanks
Renish