I created one table using DataTable by programming, i have save this DataTable in Session in Asp.Net using C#.
DataTable dt = ((DataTable)Session["productds"]);
First get the DataTable from Session into dt object using casting. After that find the DataRow that has contain that unique value using Find() Method of DataTable dt, it will return the Datarow dr that matches the SearchValue.Then call Remove() method to delete row from DataTable dt,after that call AcceptChanges() method of DataTable dt to apply chages to DataTable.
DataTable dt = ((DataTable)Session["productds"]);
DataRow dr = dt.Rows.Find(SearchValue);
dt.Rows.Remove(dr);
dt.AcceptChanges();
First get the DataTable from Session into dt object using casting. After that find the DataRow that has contain that unique value using Find() Method of DataTable dt, it will return the Datarow dr that matches the SearchValue.Then call Remove() method to delete row from DataTable dt,after that call AcceptChanges() method of DataTable dt to apply chages to DataTable.
Nice and informative post.keep it up.
ReplyDelete