예제 #1
0
        public virtual void FillCheckBoxListAnswer(CheckBoxList cbl, string answer, FillListBy FilledBy)
        {
            //FillCheckBoxListAnswer -- may only be stored in a string;
            if (!string.IsNullOrEmpty(answer))
            {
                if (FilledBy == FillListBy.Any)
                {
                    foreach (ListItem li in cbl.Items)
                    {
                        if (answer.IndexOf(string.Format(";{0};", li.Value)) > -1 || answer.IndexOf(string.Format(";{0};", li.Text)) > -1)
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                        PrintExtension(li, answer);
                    }
                }

                else if (FilledBy == FillListBy.Value)
                {
                    foreach (ListItem li in cbl.Items)
                    {
                        if (answer.IndexOf(string.Format(";{0};", li.Value)) > -1)
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                        PrintExtension(li, answer);
                    }
                }
                else
                {
                    //Text
                    foreach (ListItem li in cbl.Items)
                    {
                        if (answer.IndexOf(string.Format(";{0};", li.Text)) > -1)
                        {
                            li.Selected = true;
                        }
                        else
                        {
                            li.Selected = false;
                        }
                        PrintExtension(li, answer);
                    }
                }
            }
        }
예제 #2
0
 public virtual void FillRadioListAnswer(RadioButtonList rbl, string answer, FillListBy FilledBy)
 {
     if (!string.IsNullOrEmpty(answer))
     {
         if (FilledBy == FillListBy.Any)
         {
             foreach (ListItem li in rbl.Items)
             {
                 if (answer.IndexOf(string.Format(";{0};", li.Value)) > -1 || answer.IndexOf(string.Format(";{0};", li.Text)) > -1)
                 {
                     li.Selected = true;
                 }
                 else
                 {
                     li.Selected = false;
                 }
                 PrintExtension(li, answer);
             }
         }
         else if (FilledBy == FillListBy.Value)
         {
             foreach (ListItem li in rbl.Items)
             {
                 if (answer.IndexOf(string.Format(";{0};", li.Value)) > -1)
                 {
                     li.Selected = true;
                 }
                 else
                 {
                     li.Selected = false;
                 }
                 PrintExtension(li, answer);
             }
         }
         else
         {
             foreach (ListItem li in rbl.Items)
             {
                 if (answer.IndexOf(string.Format(";{0};", li.Text)) > -1)
                 {
                     li.Selected = true;
                 }
                 else
                 {
                     li.Selected = false;
                 }
                 PrintExtension(li, answer);
             }
         }
     }
 }
예제 #3
0
 public virtual void FillDropDownListAnswer(DropDownList ddl, string answer, FillListBy FilledBy)
 {
     //FillDropDownListAnswer -- may only be stored in a string;
     if (!string.IsNullOrEmpty(answer))
     {
         if (FilledBy == FillListBy.Any)
         {
             foreach (ListItem li in ddl.Items)
             {
                 if (answer.IndexOf(string.Format(";{0};", li.Value)) > -1 || answer.IndexOf(string.Format(";{0};", li.Text)) > -1)
                 {
                     li.Selected = true;
                 }
                 else
                 {
                     li.Selected = false;
                 }
             }
         }
         else if (FilledBy == FillListBy.Value)
         {
             foreach (ListItem li in ddl.Items)
             {
                 if (answer.IndexOf(string.Format(";{0};", li.Value)) > -1)
                 {
                     li.Selected = true;
                 }
                 else
                 {
                     li.Selected = false;
                 }
             }
         }
         else
         {
             foreach (ListItem li in ddl.Items)
             {
                 if (answer.IndexOf(string.Format(";{0};", li.Text)) > -1)
                 {
                     li.Selected = true;
                 }
                 else
                 {
                     li.Selected = false;
                 }
             }
         }
     }
 }