if (ViewState["TempDT"] != null)
{
DataTable dtCurrent = (DataTable)ViewState["TempDT"];
DR = dtCurrent.NewRow();
DR[0] = dtCurrent.Rows.Count + 1;
DR[1] = contact;
DR[2] = contactemail;
DR[3] = contactmobile;
DR[4] = contactstatus;
dtCurrent.Rows.Add(DR);
ViewState["TempDT"] = dtCurrent;
}
else if(ViewState["TempDT"]==null)
{
DT = new DataTable();
DT.Columns.Add("ContactPersonID");
DT.Columns.Add("ContactName");
DT.Columns.Add("ContactEmailID");
DT.Columns.Add("ContactMobile");
DT.Columns.Add("ContactStatus");
DR = DT.NewRow();
DR[0] = DT.Rows.Count+1;
DR[1] = contact;
DR[2] = contactemail;
DR[3] = contactmobile;
DR[4] = Convert.ToString(contactstatus);
DT.Rows.Add(DR);
//DT.Rows.Add(id, contact, contactemail, contactmobile, Convert.ToString(contactstatus));
Session["Table"] = DT;
ViewState["TempDT"] = DT;
}
GVContact.DataSource = ViewState["TempDT"];//ds.Tables["DT"].DefaultView;
GVContact.DataBind();
===============
I tried with this and got the desired result...anyways thanks for the support