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
Loading
Renish PatelPosted Jun 3, 2013, 7:38 AM
Thanks
Renish
Renish PatelPosted May 31, 2013, 7:55 AM
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...