Speedup CheckBoxList search

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Speedup CheckBoxList search

 
0
  #1
Feb 16th, 2009
I want to speed ChechBoxList's getting the selected items, the normal approach is
  1. foreach (ListItem li in checkListBox.Items)
  2. {
  3. if (li.Selected)
  4. {
  5. }
  6. }
but if I've 6000 items in the CheckListBox, that's mean I should go through the 6000 items to know which is selected. Performance POOOOOOR!!!
Is there way to get just selected ItemsCollection ??
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,318
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: Speedup CheckBoxList search

 
0
  #2
Feb 16th, 2009
That was abount the most stupid post I have sent

I think I will edit it out
wish there was a delete button
Last edited by almostbob; Feb 16th, 2009 at 10:28 am.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 104
Reputation: Aneesh_Argent is an unknown quantity at this point 
Solved Threads: 18
Aneesh_Argent Aneesh_Argent is offline Offline
Junior Poster

Re: Speedup CheckBoxList search

 
1
  #3
Feb 17th, 2009
I dont think there is a built in method to get selected ItemsCollection only. Even if there is one, the algorithm would be the same as yours. So it wont solve the performance issue. One way to do this will be to use a javascript function to append the indices of only the selectedItem to a hiddenfield on its onClientClick event and then to parse the hidden field value in your code behind to get the Selected item indices.
If you get another good reliable way of doing it please post it here so that everyone can learn
Thanks
Last edited by Aneesh_Argent; Feb 17th, 2009 at 1:05 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Speedup CheckBoxList search

 
0
  #4
Feb 17th, 2009
I got this solution too but for some reasons I preferred server side, yes Java Script would be better, Thank you Aneesh_Argent so much
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC