Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add where clause to SQLDataSource with parameter from anothe SQLDataSo

Status
Not open for further replies.

daughtd

Programmer
Sep 6, 2006
15
US
I have two SQLDataSources I'll call them SQL1 and SQL2.

SQL1 returns all from a table and is the datasource for a datalist.

SQL2 is used as Datasource for a listbox inside my datalist. But I want to add a where clause that filters the rows returned based on a field returned in SQL1.

Is this possible?
 
yes, very much.

You will have to use the ItemDataBound command for that. i guess the where clause value changes for each item right??

Known is handfull, Unknown is worldfull
 
then please try the ItemDataBound event.

in that event you can get the information of the currently binding data using this:

e.Item.DataItem

The above will give you the DataRow. using that you can pick the Column's info that you want in SQL1 and use it to filter SQL2...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top