Thursday, January 17, 2013

Check to see if a Session of ViewState variable exists before trying to cast it to a type.

if (ViewState["AddOrAlter"] != null)
{
   if (ViewState["AddOrAlter"] as string == "add")
   {
      string whatever = "somethingerother";
   }
}

No comments:

Post a Comment