How filter dropdownlist data

C

Cirene

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.
 
C

Cirene

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 said:
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 said:
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.
 
E

Eliyahu Goldin

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 said:
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 said:
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 said:
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.
 
G

George Ter-Saakov

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 said:
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 said:
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 said:
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.
 
C

Cirene

i'll give it try - thanks everyone

Eliyahu Goldin said:
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 said:
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 said:
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


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.
 
M

Milosz Skalecki [MCAD]

Howdy,

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

HTH
--
Milosz


Cirene said:
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 said:
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 said:
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.
 
C

Cirene

Does the dropdown have a similar property? Thanks!!

Milosz Skalecki said:
Howdy,

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

HTH
--
Milosz


Cirene said:
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 said:
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


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.
 
M

Milosz Skalecki [MCAD]

Cirene,

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

regards
--
Milosz


Cirene said:
Does the dropdown have a similar property? Thanks!!

Milosz Skalecki said:
Howdy,

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

HTH
--
Milosz


Cirene said:
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!


message 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


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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top