I came across a situation where I needed to get a Querystring value and evaluate it against a Enum used for display modes.
// Display Mode Enum
public enum Mode
{
View,
Add,
Edit
}
// Evalutate Querystring
object oDisplayMode = Request.QueryString["mode"];
if (oDisplayMode != null)
{
displayMode = (Mode)Enum.Parse(typeof(Mode), oDisplayMode.ToString(), true);
// Put into ViewState for next postback
ViewState["DisplayMode"] = displayMode;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment