ViewState["id"] = e.CommandArgument.ToString().Trim();
int r = Namespace.SPs.StoredProcedure(Convert.ToInt32(ViewState["id"])).Execute
Here there may be two issues with the code
1.You are Assigning the Command Argument value to the View sate in string format.
2.Again you are converting the string value to the Int32
The conversion should depend on the type of the parameter in the Stored Procedure Method.
if you can put the Method details it would be helpful.