locked
Column Attibute making other columns required when populated RRS feed

  • Question

  • I have a task that in a a table like so

    Column

    ID

    Subject

    Column1

    Column2

    That when the "Subject" column is populated then both Column1 and Column2 are required. Is there a way to achieve this through DataAnnotations?

    I would assume I could extend a required attribute?

    Tuesday, July 10, 2012 12:56 PM

Answers

  • Hi nick5454;

    To your question, "That when the "Subject" column is populated then both Column1 and Column2 are required. Is there a way to achieve this through DataAnnotations?", The short answer is no. Annotation is either attached to a column or not and there is no conditional attribute. You will need to accomplish this through code.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by nick5454 Wednesday, July 11, 2012 6:39 PM
    Tuesday, July 10, 2012 2:05 PM