473,387 Members | 1,455 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,387 software developers and data experts.

How filter dropdownlist data

I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.
Jun 27 '08 #1
8 2532
If the query populates a DataTable, you can run Select method with a filter
condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.

Jun 27 '08 #2
I already have it bound to a sqldatasource and it's getting data. That's no
problem.

There are certain conditions where I want to PREVENT some selected items
from appearing in the drop down list. Any ideas on how to do this?

Thanks!
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ej***************@TK2MSFTNGP06.phx.gbl...
If the query populates a DataTable, you can run Select method with a
filter condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.


Jun 27 '08 #3
You can handle ddl's DataBound or PreRender or Page.PreRender event to
remove items from the ddl's Items collection.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
>I already have it bound to a sqldatasource and it's getting data. That's
no problem.

There are certain conditions where I want to PREVENT some selected items
from appearing in the drop down list. Any ideas on how to do this?

Thanks!
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ej***************@TK2MSFTNGP06.phx.gbl...
>If the query populates a DataTable, you can run Select method with a
filter condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>>I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.



Jun 27 '08 #4
How about not bounding it
just populate the dropdown manually...

something like (in pseducode):

DataTable dt = GetData("SELECT...");
foreach(DataRow r in dt.Rows)
{
ListItem it = new ListItem((string)r[0], (string)r[1]);
cmbMyDropDown.Items.Add(it);
}
George.
"Cirene" <ci****@nowhere.comwrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
>I already have it bound to a sqldatasource and it's getting data. That's
no problem.

There are certain conditions where I want to PREVENT some selected items
from appearing in the drop down list. Any ideas on how to do this?

Thanks!
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ej***************@TK2MSFTNGP06.phx.gbl...
>If the query populates a DataTable, you can run Select method with a
filter condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>>I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.



Jun 27 '08 #5
i'll give it try - thanks everyone

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:er**************@TK2MSFTNGP04.phx.gbl...
You can handle ddl's DataBound or PreRender or Page.PreRender event to
remove items from the ddl's Items collection.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
>>I already have it bound to a sqldatasource and it's getting data. That's
no problem.

There are certain conditions where I want to PREVENT some selected items
from appearing in the drop down list. Any ideas on how to do this?

Thanks!
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ej***************@TK2MSFTNGP06.phx.gbl...
>>If the query populates a DataTable, you can run Select method with a
filter condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.



Jun 27 '08 #6
Howdy,

You can also use sqldatasource.FilterExpression and FilterParameters to
filter out results fetched from the database.

HTH
--
Milosz
"Cirene" wrote:
I already have it bound to a sqldatasource and it's getting data. That's no
problem.

There are certain conditions where I want to PREVENT some selected items
from appearing in the drop down list. Any ideas on how to do this?

Thanks!
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ej***************@TK2MSFTNGP06.phx.gbl...
If the query populates a DataTable, you can run Select method with a
filter condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.


Jun 27 '08 #7
Does the dropdown have a similar property? Thanks!!

"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:8B**********************************@microsof t.com...
Howdy,

You can also use sqldatasource.FilterExpression and FilterParameters to
filter out results fetched from the database.

HTH
--
Milosz
"Cirene" wrote:
>I already have it bound to a sqldatasource and it's getting data. That's
no
problem.

There are certain conditions where I want to PREVENT some selected items
from appearing in the drop down list. Any ideas on how to do this?

Thanks!
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ej***************@TK2MSFTNGP06.phx.gbl...
If the query populates a DataTable, you can run Select method with a
filter condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.



Jun 27 '08 #8
Cirene,

No it doesn't as the SqlDataSource is responsible for providing the data
(one of the possible "data set" providers.

regards
--
Milosz
"Cirene" wrote:
Does the dropdown have a similar property? Thanks!!

"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:8B**********************************@microsof t.com...
Howdy,

You can also use sqldatasource.FilterExpression and FilterParameters to
filter out results fetched from the database.

HTH
--
Milosz
"Cirene" wrote:
I already have it bound to a sqldatasource and it's getting data. That's
no
problem.

There are certain conditions where I want to PREVENT some selected items
from appearing in the drop down list. Any ideas on how to do this?

Thanks!
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ej***************@TK2MSFTNGP06.phx.gbl...
If the query populates a DataTable, you can run Select method with a
filter condition to produce a filtered array of rows.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
I have a dropdownlist that is bound to a query.

Is it possible to further filter the items after the fact?

The dropdownlist is inside a
createuserwizard/createuserstep/contenttemplatecontainer.

Thanks.





Jun 27 '08 #9

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

Similar topics

2
by: rmorvay | last post by:
I am trying to dynamically build a dropdownlist and bind it to a cell in a grid. I tried to utilize the following code but I am stuck at the point where I bind the dropdownlist to the grid cell. ...
4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
18
by: Julia Hu | last post by:
Hi, I have a datagrid, and in different rows I need to programmatically bind different type of controls and load data into these controls. For example,in the first row I need to bind data into a...
0
by: RyanG | last post by:
when the value that determines the filter is databound?? I am trying to make a DropDownList for a set of data that I use a lot throughout my project. So I extended the DropDownList to retrieve...
8
by: utterberg | last post by:
Hi I'm adding two dropdownlist in my webform by clicking a button. I fill the first dropdown with some values from my DB and the other one when I choose from the first dropdown. But since theese...
3
by: Juanjo | last post by:
I have a datagrid with two temnplate columns. When a row is in edit mode the each template columns show a dropdownlist (its datasource is a dataview). I need to filter data of second dropdownlist...
0
by: Juanjo | last post by:
Hi, Before, I was working with Asp.net 1.0 and datagrid. I posted a question for this issue. The solution of this problem is load the second dropdownlist on the selectedindexchanged event of the...
3
by: simonZ | last post by:
In gridView I have dropdown list : <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField...
3
by: EdisonCPP | last post by:
Hi, I have a DetailsView with a template field with a dropdownlist added to it. If the data coming into that field were put into a textbox, it would look like: Small|Medium|Large|X-Large. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.