Reputation: 447
I have a site where people can upload images into a sort of "image mosiac". They can select from a drop down of 36 different positions. Is there a way to disable certain selections from the dropdown if it has already been selected. I don't care if it is grayed out, removed, disabled, or simply having an error message in the error label (which is already there and functioning) saying "please select a different location" (or whatever I decide later).
I just don't want people to select a duplicate location and have the app submit the video. What kind of checking can I put in this?
protected void PopulateImagePosition()
{
String[] imagePositions = video.ListImagePositions();
image_position.Items.Add(new ListItem("----- Please Select -----", ""));
foreach (String tmpPosition in imagePositions)
{
String[] parts = tmpPosition.Split(new char[] { '|' });
image_position.Items.Add(new ListItem(parts[1], parts[0]));
}
}
This is C# .NET. If I need to have additional; code please let me know, any help would be appreciated. Thank in advance!
Upvotes: 0
Views: 172
Reputation: 45096
Got to try stating the obvious
foreach (String tmpPosition in imagePositions)
{
// add logic here to skip if imagePosition has already been selected
// or just don't include it in imagePositions if it has already been selected
String[] parts = tmpPosition.Split(new char[] { '|' });
image_position.Items.Add(new ListItem(parts[1], parts[0]));
}
Upvotes: 1