title: Input string was not in a correct format.‎
body: <p>When I am Passing the Value of the selected in the Gridview for deletion it throws Input String was not in correct format exception My Code is,</p>
  
  <pre><code>    protected void gridview1_RowCommand(object sender, GridViewCommandEventArgs e)
     {
      if (e.CommandName.ToUpper().ToString() == "DELETEREC")
      {
          try
          {
              ViewState["id"] = e.CommandArgument.ToString().Trim();
              int r = Namespace.SPs.StoredProcedure(Convert.ToInt32(ViewState["id"])).Execute();//Exception thrown Here
              if (r &gt; 0)
              {
                  ClientMessaging("Record Deleted Successfully");
                  Clear();
                  fillgrid();
              }
          }
          catch (SqlException ex)
          {
              ClientMessaging(ex.Message);
          }
      }
  }
  </code></pre>
  
  <p>Kindly help me out in this</p>
  
  <p>My SP Method is,</p>
  
  <pre><code>    public static StoredProcedure StoredProcedure(int id)
        {
              SubSonic.StoredProcedure sp = new SubSonic.StoredProcedure("StoredProcedure",    DataService.GetInstance("TEST"), "");
             sp.Command.AddParameter("@Id", id, DbType.Int32);
  
              return sp;
         }
  </code></pre>