Below is switch case
switch (strID)
{
case ConfigurationManager.AppSettings["Key1"].ToString():
Label1.Visible = true;
break;
case ConfigurationManager.AppSettings["Key2"].ToString():
Label2.Visible = true;
break;
case ConfigurationManager.AppSettings["Key3"].ToString():
Label3.Visible = true;
break;
default:
Label1.Visible = true;
break;
}
But it gives error "A constant value is expected."
I know that you can't have variables in the switch statement.But is any way ?