By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,159 Members | 1,941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,159 IT Pros & Developers. It's quick & easy.

master detail datalist

P: n/a
I have a master detail datatable and add a relation
DataRelation relation = new DataRelation("PartNoRelation", Dt_Cart.Columns["PartNo"], Tbl_NearestCenters.Columns["PartNo"],false);
when I try to add my detail to a radiobutton list in datalist(the master information are show in data list)I use this code
but it shows all the data in detail table not just the related one

private void DataList1_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
DataTable Tbl_Info= ( DataTable ) Session [ "myTable" ];
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)

((RadioButtonList) e.Item.FindControl("dProducts")).DataSource = ((DataRowView) e.Item.DataItem).CreateChildView("PartNoRelation") .Table.DefaultView;
((RadioButtonList) e.Item.FindControl("dProducts")).DataTextField="Wa reHouseZipCode";
((RadioButtonList) e.Item.FindControl("dProducts")).DataValueField="W areHouseZipCode";
((RadioButtonList) e.Item.FindControl("dProducts")).DataBind();
((RadioButtonList) e.Item.FindControl("dProducts")).AutoPostBack = true; }

I tried to check if my relation works
foreach(DataRow drPublisher in Tbl_Info.Rows) { Response.Write(drPublisher["PartNo"]);

foreach(DataRow drTitle in drPublisher.GetChildRows("PartNoRelation"))
it works good and shows just the related information for each master detail
why doesnt' it work in my data list? }

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.