How filter dropdownlist data

  • Thread starter Thread starter Cirene
  • Start date Start date
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
Back
Top