I am looking for a better way of accomplishing my task. My thought process today is a little out of wack and I am getting frustrated so I am searching for answers. I have created a custom error class. When applying an error message, for example account not created, I am passing an int value through the query string. The problem I am dealing with is how to keep the retrieving of the message value to display in a label's text without having to use a cumbersome switch statement. I tried assigning the values to an enum, which I do not know enough about, but I have found that not to be a good way to handle it; at least it does not seem to be. The code below is a smaller version of what I have going on.
public class Messages
public static string ItemConfigNotFound = "Items configuration section could not be found";
public static string ItemProviderInstantiationError = "Items default provider could not be instantiated";
public static string CategoryIdUndefined = "Category 'Id' is not defined";
public static string CategoryTitleUndefined = "Category 'Title' is not defined";
public static string ItemIdUndefined = "Item 'id' not defined";
public static string ItemTitleUndefined = "Item 'title' not defined";
public static string ItemTitleIsNull = "Title must be a non null, non-empty string";
public static string ItemRequiredAttributesMissing = "Some of the required attributes of Item are NULL in the Items table";
public static string CategoryRequiredAttributesMissing = "Some of the required attributes of Category are NULL in the Category table";
public static string NewsConfigSectionNotFound = "News configuration section could not be found";
//Error page receives a query string with an interger value named errMsg
if (Request.QueryString["Message"] != "")
errMsg = Request.QueryString["Message"];
//this is the problem: I have 24 error messages. I would like to have more efficient code.