Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2008, 08:20 PM
Authorized User
 
Join Date: Jan 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default ArrayList Filtering

Hi

I am using Vb.net m ASP.net...

I have an ArrayList that contains a list of items that actually appear in the DDL as shown in the code bellow:

1 Dim list As ArrayList
2 list = New ArrayList
3 DDL.DataTextField = "Title"
4 DDL.DataValueField = "BlogID"
5 DDL.DataSource = list
6 DDL.DataBind()

What i am trying to do is to perform filtering on the Arraylist Such that all the Titles that start from letter A will be copied from original ArrayList "list" to new ArrayList "listA ", similarly all Titles that start from letter B will be copied into the ArraList listB and so on...But I also want to maintain the original ArrayList "list" for future use.

Any code will be really appreciated.



Many Thanks in advance...



Sheraz



 
Old February 11th, 2008, 01:23 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What is your ultimate goal? Are you looking to provide a DDL that shows A thru Z and then based on the selection, shows another with just those that begin with the chosen letter?

You can filter an array using the FindAll<T> generic method of the System.Array class. You create a test method either explicitly or as an anonymous method that tests the object for the desired condition. Look at the method MSDN page for an example that's very similar to what you want to test for.

-Peter
 
Old February 11th, 2008, 03:30 PM
Authorized User
 
Join Date: Jan 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply..

Well I want links from A - Z on top of the DDL , it will work like if user select A the DDL will load all the Titles start with the letter A....

Any code will be really appreciated..





Similar Threads
Thread Thread Starter Forum Replies Last Post
ArrayList Mogg-Way C# 2005 5 February 12th, 2008 04:05 PM
Arraylist mechanism anwarraja Pro Java 1 September 6th, 2007 11:54 AM
ArrayList sort collie C# 1 August 28th, 2007 08:08 AM
Help with an arraylist crazy-nun General .NET 4 July 14th, 2005 03:32 AM
ArrayList kobystud C# 4 May 25th, 2004 02:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.