473,414 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Search DropDownList

Hi,

I retrieve data from a SQL Server and put the data on a DropDownList, but
my problem is that sometime i have the same value more than one time, so i
want to search the DDL to see if there's already an item with the same
value.

Is there a way to search the DDL to check that the same value as not
already been entered, so i can modify it.

I've tried with FindByText, but i cannot make it work.

Thank you
Nov 19 '05 #1
2 3619
Salut André,

There are ways to do this in code, but is there a reason why you can't use
the SQL query to ensure unique values?

"Use DISTINCT with SELECT
This example uses DISTINCT to prevent the retrieval of duplicate author ID
numbers."

USE pubs
SELECT DISTINCT au_id
FROM authors
ORDER BY au_id
Ken
Microsoft MVP [ASP.NET]
"Andre" <we*******@cablevision.qc.ca> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Hi,

I retrieve data from a SQL Server and put the data on a DropDownList,
but my problem is that sometime i have the same value more than one time,
so i want to search the DDL to see if there's already an item with the
same value.

Is there a way to search the DDL to check that the same value as not
already been entered, so i can modify it.

I've tried with FindByText, but i cannot make it work.

Thank you


Nov 19 '05 #2
Hi,

The problem is that i'm retreiving an invoice list from my database, and
in the DDL i display the month...

Ex : March 2004, February 2004 etc..

And i put the ID Number of the invoice in the value field with
FindByText.

The problem is; if i have 2 invoice or more in the same month (Ex: March
2004).. the FindByText will find the first and will always put the value
there..

Thanks.
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> a écrit dans le
message de news: uR****************@TK2MSFTNGP14.phx.gbl...
Salut André,

There are ways to do this in code, but is there a reason why you can't use
the SQL query to ensure unique values?

"Use DISTINCT with SELECT
This example uses DISTINCT to prevent the retrieval of duplicate author ID
numbers."

USE pubs
SELECT DISTINCT au_id
FROM authors
ORDER BY au_id
Ken
Microsoft MVP [ASP.NET]
"Andre" <we*******@cablevision.qc.ca> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Hi,

I retrieve data from a SQL Server and put the data on a DropDownList,
but my problem is that sometime i have the same value more than one time,
so i want to search the DDL to see if there's already an item with the
same value.

Is there a way to search the DDL to check that the same value as not
already been entered, so i can modify it.

I've tried with FindByText, but i cannot make it work.

Thank you

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
0
by: Hema S | last post by:
Hi, I want to have a speed search in dropdownlist in my asp.net application. Is there any freeware available. I have downloaded source from net that has textbox and button embeded in the...
3
by: Mark Goldin | last post by:
Can a dropdownlist be a fully functional Incremental search control? As far as I can see it only takes a first letter when I am trying to type something in. Thanks
1
by: mimo | last post by:
Hello, I have seen several examples with a dropdownlist filtering the results in a gridview. Is there a way to have information typed in a text box used to filter a gridview? I would like...
0
by: Seok Bee | last post by:
Dear Experts, I would like to have a listing of my current table records based on certain search criterias to list out in the gridview control. However, I have tried to use the built-in...
1
OuTCasT
by: OuTCasT | last post by:
i have 4 dropdownlist boxes on my form. it controls a datagridview on the page. The datagridview is populated with certain values from the selections of the dropdownlist boxes. i got the select...
1
by: scottichrosaviakosmos | last post by:
Please solve my issue . i want to develope a search form for which will search the values from a table and fetch the values from the table and show that value in the a gridview. now i am going...
22
by: asmx126453 | last post by:
hey guys can somonehelp i got an error on rule 3 and it says error: txtbox is empty or not an object this is the code out my aspx page <script language="javascript"...
2
by: rajendrsedhain | last post by:
Hi, I have 1 checkboxlist, 5 dropdownlits and three textboxes.I have to write the SQL query and c# code for that advanced search. <asp:CheckBoxList ID="reposotoryCheckBoxList" runat="server"...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.