Hi,
I have a Gridview and one button ADD which will insert new row to Gridview and is outside of Gridview. Gridview contain one button DELETE column which is used to delete that row from gridview.
When the Delete button is clicked I want to delete that row For this I am doing like this: Where ID is the unique column in Gridview.
private DataRow FindRowByID(string id)
{
DataTable dt = (DataTable)Session["dt"];
DataRow[] rows = dt.Select("ID = " + id.ToString());
return rows[0];
}
Gridview_RowCommand()
{
if (e.CommandName == "RemovePartner")
{
string ind = e.CommandArgument.ToString();
FindRowByID.Delete(ind);
}
}
This is working fine when the inserted row ha ID value. If the user add a new row but did not enter any value into ID column and clicked on Delete then ID contain null value then how to delete that newly inserted row from Gridview.
Thanks
I have a Gridview and one button ADD which will insert new row to Gridview and is outside of Gridview. Gridview contain one button DELETE column which is used to delete that row from gridview.
When the Delete button is clicked I want to delete that row For this I am doing like this: Where ID is the unique column in Gridview.
private DataRow FindRowByID(string id)
{
DataTable dt = (DataTable)Session["dt"];
DataRow[] rows = dt.Select("ID = " + id.ToString());
return rows[0];
}
Gridview_RowCommand()
{
if (e.CommandName == "RemovePartner")
{
string ind = e.CommandArgument.ToString();
FindRowByID.Delete(ind);
}
}
This is working fine when the inserted row ha ID value. If the user add a new row but did not enter any value into ID column and clicked on Delete then ID contain null value then how to delete that newly inserted row from Gridview.
Thanks