473,657 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3625
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*******@cabl evision.qc.ca> wrote in message
news:Oo******** ******@TK2MSFTN GP10.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************* ***@TK2MSFTNGP1 4.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*******@cabl evision.qc.ca> wrote in message
news:Oo******** ******@TK2MSFTN GP10.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
2779
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 Description"></asp:BoundColumn> <asp:TemplateColumn runat="server" HeaderText="Id Type Option" "> <itemtemplate> <asp:label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "TypeOption") %>' /> <asp:label runat="server" ID="LlbTypeOption" Visible=False...
0
1112
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 combo which serves my purpose. But the problem is when i dynamically embed the control on each user request in a data grid, when postback occurs the page gets totally disoriented and when the combo loads it literally show the loading of its child...
3
1817
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
4403
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 to for example search on a persons first name and any first name that contains the contents of my text box appear in the gridview list.
0
1093
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 filtering function from the datasource. It is not exactly what I wanted. I have more than 1 search criterias and want to have the filtering based on the condition I set through the controls in the form. This may be a combination of 1 search condition or...
1
1486
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 statement to retrieve the information that i require from the different selections. Problem is that if i leave 1 dropdownlist box with no selection no information is returned into the datagridview.. here is the select statement that ive used it...
1
1029
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 t describe everything:. i have a table suppose tbl_update which having following coloums: tb_id int
22
7452
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" src="AlgemeneFuncties.js"></script> </HEAD> <body onload="InitCombobox(document.VerzamelbladOverzicht.txtKlant1, document.VerzamelbladOverzicht.DDLKlant1);"> <form id="Span2" runat="server">
2
1617
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" Style="z-index: 106; left: 226px;position: absolute; top: 18px"> asp:ListItem Text="computer" Value="2"></asp:ListItem> <asp:ListItem Text="math" Value="3"></asp:ListItem> <asp:ListItem Text="science" Value="1"></asp:ListItem>--%>
0
8384
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8718
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.