Question:
remove duplicates in asp.net listbox?
babilla1983
2007-02-19 06:58:10 UTC
i want to remove all duplicated items stored in a list box. i am working on a web site with asp.net.I tried over 30 method but i couldn't get to my goal.i think if i was working on a windows application , it could be much easier to remove the duplicates.But can any one help me to remove those duplicated items in asp.net web application.Anyway thanks for reading.
Three answers:
2007-02-19 08:57:07 UTC
I'd do this by putting the listboxitems into a datatable, then rebinding the listbox with the datatable after removing dupes.



Code to do just that in VB.NET here:



http://geocities.com/dhvrm/aspnet_2_remove_dupes_listbox.html
2007-02-19 07:16:50 UTC
Try a ruby code. I do not do asp.net stuff but I know ruby interacts (in human language) with almost everything it comes across.

Identify the dupe string: then;

rb. 'move_to_zoink'

Where Zoink is the folder that will auto delete after 1 hour.

.rb print "Hello_World" [enter]

http://www.ruby-lang.org/en/



# The famous Hello World

# program is trivial in

# Ruby. You don't need:

#

# * a "main" method

# * newline escapes

# * semicolons

#

# Here's the code:



puts "Hello World!"

That is how easy it is.

I would do the one_hour thing just to make backups of data.

The IRB , Interactive Ruby has the make_backup auto script in it.
Smutty
2007-02-19 07:48:44 UTC
You're Data tier (table in database) should not contain duplicates in the first place. Even if thats the case, this is a task you should perform on the Data Tier.



For example if you're using SQL Server, retrieve distinct records as in



SELECT DISTINCT Plates FROM Menu WHERE Salad like '%greek%'



Something tasty like that.



Thank You.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...