validation for two items RRS feed

  • Question

  • I have a dropdown list named "category" coming from another table and also i have a "code" field in my form. one category must have a unique code and many category can have that unique code. how to validate it?? plz do help me out...

    Example for my problem is

    suppose i have 3 category named { Finance, Marketing, HR }

    so Finance can only hold code ABC

    also Marketing can also hold code ABC

    but Finance cannot hold or marketing cannot hold code ABC more than once...

    and I have to validate it.

    Monday, February 18, 2013 11:23 AM


All replies

  • There are about 10000 classes in .Net which can hold a table, about which one you are talking?


    Monday, February 18, 2013 11:31 AM
  • Sir I am talking about validation of those attributes. Plz do provide me the hint how could i do it.
    Tuesday, February 19, 2013 4:22 AM
  • Hi Brajesh,

    Welcome to the MSDN Forum.

    Here is my thought:

    1. Make a dictionary: http://msdn.microsoft.com/en-us/library/xfhwa508.aspx  The Tkey is the type of your code, and the Tvalue is the category type.

    2. Check the key(in your case, it is the value of code) is already in dictionary: http://msdn.microsoft.com/en-us/library/kw5aaea4.aspx if not exist, it indicate that this code is not be occupied, Add the key-value pair into this dictionary.

    3. If it existed, it indicate the key is been occupied by another category, you can make your own logic with this situation.

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Mike Feng Thursday, February 28, 2013 1:04 PM
    Thursday, February 21, 2013 7:50 PM