title: Unable to clear viewstate
body: <p>Hi all I am assigning a Datatable for viewstate on certain operations like on each button I will assign a row and will bind that to datatable and assigning that datatable to viewstate. I am having a gridview which was binded with datatable that I was creating. In that I am having a delete option on deleting a row I cleared the Viewstate and assign it with new datattable</p>
  
  <pre><code>DataTable dtPayment = new DataTable();
  
  protected void Page_Load(object sender, EventArgs e)
  {
     if (!IsPostBack)
     {
     }
   }
  
  protected void btn_Click(object sender, EventArgs e)
  {
    if (ViewState["CurrentTable"] == null)
    {
      dtPayment.Columns.Add("Id", typeof(string));
      dtPayment.Columns.Add("PaymentMode", typeof(string));
      dtPayment.Columns.Add("TransactionAmount", typeof(string));
      dtPayment.Columns.Add("BankCharges", typeof(string));
      dtPayment.Columns.Add("Particulars", typeof(string));
  
       DataRow dr = dtPayment.NewRow();
       dr["Id"] = 1;
       dr["PaymentMode"] = "Cheque";
       dr["TransactionAmount"] = txtAmount.Text;
       dr["BankCharges"] = "";
       dr["Particulars"] = "";
       dtPayment.Rows.Add(dr);
       ViewState["CurrentTable"] = dtPayment;
       grd.DataSource = dtPayment;
       grd.DataBind();
    }
   else
   {
      AddNewRowToGrid("Cheque", txtAmount.Text);
   }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>protected void grd_Deleting(object sender, DeletingEventArgs e)
  {
     dt = (DataTable)ViewState["CurrentTable"];
     int iIndex;
     iIndex = grd.FocusedRowIndex;
     dt.Rows[iIndex].Delete();
     dt.AcceptChanges();
     ViewState.Remove("CurrentTable");
     ViewState["CurrentTable"] = dt;
     grd.DataSource = dt;
     grd.DataBind();
  }
  
   protected void AddNewRowToGrid(string strPaymntMode, string transAmount)
      {
          int rowIndex = 0;
          //SetPreviousData();
          if (ViewState["CurrentTable"] != null)
          {
              DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
              DataRow drCurrentRow = null;
              if (dtCurrentTable.Rows.Count &gt; 0)
              {
                  for (int i = 1; i &lt;= dtCurrentTable.Rows.Count; i++)
                  {
                      drCurrentRow = dtCurrentTable.NewRow();
                      drCurrentRow["Id"] = i + 1;
                      drCurrentRow["PaymentMode"] = strPaymntMode;
                      drCurrentRow["TransactionAmount"] = transAmount;
                      drCurrentRow["BankCharges"] = "";
                      drCurrentRow["Particulars"] = "";
                      rowIndex++;
                  }
                  dtCurrentTable.Rows.Add(drCurrentRow);
                  ViewState["CurrentTable"] = dtCurrentTable;
                  grd.DataSource = dtCurrentTable;
                  grd.DataBind();
              }
          }
  
      }
  </code></pre>
  
  <p>But when viewing it after one delete the datatable remains same as per the one with previous values can some one tell where I went wrong</p>