Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would like to ask, how to disable the value in drop down menu after being selected? I mean, let says if when User A select value B in drop down list, B is not available to be selected anymore to any user. How to do that?

share|improve this question
add comment

1 Answer 1

you should be able to have an event handler for that dropdown menu and from there you have many options! it depends on what you mean anyother user cant select it, if you mean only within that session or untill the whole process or never again?

DropDownList DropDownList1 = new DropDownList();
DropDownList1.SelectedIndexChanged += new EventHandle(DropDownList1_SelectedIndexChanged);

so the first line you have your dropdown list and then the second part is creating an event for your dropdown list. That event fires when the item you select has changed from the origional and it will trigger this:

    private void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //put your code here ;)
    }

You can save to the database the values that have been selected and populate the dropdownbox onloading of the page? thats if its over a long period of time or forever.

If its only for the session than you can create an array and store the values that have been selected. Once you store it you need to repopulate your list to only include the options that havent been selected.

the above method you can also use if you want to keep the values in but not allow the values to be selected but you would need to do some validation against the array to check if its currently selected == arraylist values.

So there are many options for you to do what you want to do but you need to be more specific in what you want to do, over how long you want to do it :)

hope this helps :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.