Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 December 17th, 2003, 01:38 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Search combo


I have combobox which is filled from database.
Afterwords i will get a criteria for searching a combo by value.
Hao can i make item in combo to be selected when value in combo match critiria.
Thanks
 
Old December 17th, 2003, 02:15 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Is this search going to happen on the server or client side? Makes a big difference on how you implement it.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old December 17th, 2003, 02:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

When you say combobox do you mean DropDownList?

the dropdownlist has 3 properties

myDropDown.SelectedIndex
myDropDown.SelectedItem.Text
myDropDown.SelectedItem.Value

I would try matching the SelectedItem property to the value from the search.

 
Old December 17th, 2003, 02:22 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Using SelectedItem would not work. SelectedItem is the ListItem that is selected. If you were do this server side, you would need to use FindByText() or FindByValue(). However, if you needed to do a partial text search (to find a closest match) then you'd need to iterate thru all the ListItems in the Items() collection and then see if the search string is in the ListItem.Text or ListItem.Value.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old December 18th, 2003, 05:09 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot
findbyvalue is working good
Alex





Similar Threads
Thread Thread Starter Forum Replies Last Post
Search for a String Match combo Box tsadok VB Databases Basics 0 January 27th, 2008 02:24 AM
Combo to Search for Record w/Calendar Object Odeh Naber Access 10 May 14th, 2007 07:23 AM
I Challenge U! Combo Search with Calendar Object Odeh Naber Access VBA 1 April 24th, 2007 06:54 AM
Search command button for combo box dinointheuk Other Programming Languages 1 October 6th, 2005 01:46 AM





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