+ Start a Discussion
Annette Grant 13Annette Grant 13 

Hi, I have 12 questions and the responses are from a picklist. The picklist choices are (1,2,Achieved,not achieved). The response 1 and 2 can only be selected once. If selected more than once an error needs to be generated.

Nishant Prajapati 10Nishant Prajapati 10
Hi,

You can create a wrapper class in you class, which contains following properties:
public class WrapperClass{
      public string question {get;set;}
      public string answer {get;set;}
}

the method in which you're inserting records, iterate over the List<WrapperClass> and check if 'answer' property of instance from List<WrapperClass> is '1' or '2'.