ASP.NET DropDownList Replacement

Posted by user302004 on Stack Overflow See other posts from Stack Overflow or by user302004
Published on 2010-03-26T14:45:19Z Indexed on 2010/03/26 15:23 UTC
Read the original article Hit count: 242

Filed under:
|
|

Currently, I'm populating a drop down list when a file is created in a configurable folder.

if (!downloadRspDropDown.Items.Contains(new ListItem(txt, fileData.FullName))

Then, I add the file and remove "No Responses Available".

However, if the same file is resubmitted (i.e., the file name is the same but the timestamp is different), then I want to remove the older entry and replace it with a new entry in the drop down list.

I have the filename, so I go into the "else" block from the line of code above. From there, I'm checking to see if I have the same filename and a different creation time.

if (downloadRspDropDown.Items.Contains(new ListItem(txt, fileData.FullName) && downloadRspDropDown.Items.Contains(new ListItem(txt, fileData.CreationTime)

From here, I want to find the position, remove it, and add the new text. This approach isn't working. Can anyone offer an alternate approach?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET