Click here to Skip to main content
15,943,477 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
string selectedAction = ddlPatientStatus.SelectedValue;
         switch (ddlPatientStatus.SelectedValue)
         {
             case "4":
                 ddl_team_val.Enabled = true;
                 ddl_work_val.Enabled = true;
                 ddl_membership_val.Enabled = true;
                 ddl_status_val.Enabled = true;
                 ddl_documentstype_val.Enabled = true;
                 ddl_insurance_val.Enabled = true;
                 ddl_sex_val.Enabled = true;
                 ddl_income_val.Enabled = true;
                 ddl_location_val.Enabled = true;
                 goto case "8";
             case "9":
                 date_due_val.Enabled = true;
                 goto case "3";
             case "3":
                 ddl_Patient_val.Enabled = true;
                 goto case "2";
             case "2":
                 date_Procedure_val.Enabled = true;
                 goto case "8";
             case "1":
             case "5":
             case "6":
             case "7":
             case "8":
                 Comments_val.Enabled = true;
                 break;
             default:
                 break;
         }



I am having issues with Case "4" repeating itself for all other DropDownList Values that have Required Validation. I need to figure out a way to break this.
Posted

1 solution

Instead of goto just put the required lines in your case :
C#
case "2":
       date_Procedure_val.Enabled = true;
       Comments_val.Enabled = true;
       break;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900