Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Databinding with intermediary table

Reply
Thread Tools

Databinding with intermediary table

 
 
Zebrahead
Guest
Posts: n/a
 
      03-27-2007
Hi all,

I have a dataset with 3 tables:
1. Items with columns: ItemId, Name
2. Categories with columns: CategoryId, name
3. ItemsCategory with columns: ItemId, CategoryId (serves to identify which
items belong to which categories.)

When the user selects a category from a dropdown list I need to display the
Items for that category in another dropdown list. Before I used to go to the
database every time and get the data with a query like:

SELECT Items.ItemId, Items.Name FROM Items, ItemsCategory WHERE
ItemsCategory.CategoryId = list.SelectedIndex and Items.ItemId =
ItemsCategory.ItemId.

How do I perform a similar query with a dataset?

So far I have been able to get the Items for the selected Category by using:

DataView cView = new DataView(ItemsSet.Tables["ItemsCategory"],
"","CategoryId", DataViewRowState.CurrentRows);
DataRowView[] foundRows = cView .FindRows(new object[]
{list.SelectedIndex.ToString()});

But I am unable to make my Items dropdown list display only those Items.
(The Items.ItemId column is the Items' dropdown list's datavaluefield)
Creating a datarelation between the Items and ItemsCategory table has no
effect and creating a datarelation berween Items and DataRowView generates an
error.

Any suggestions and/or links to tutorials greatly appreciated!

Thanks in advance!

Zebrahead.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databinding expressions are only supported on objects that have a DataBinding event jobs ASP .Net 0 09-25-2007 11:54 PM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin ASP .Net 1 11-12-2006 01:43 PM
Is Apache axis support intermediary of soap1.2? pos Java 1 02-27-2004 08:05 AM
Is Apache Axis Release software version 1.2alpha or other version support intermediary of soap1.2? pos Java 0 02-18-2004 08:45 AM
Is Apache axis support intermediary of soap1.2? pos Java 0 02-18-2004 08:20 AM



Advertisments