469,576 Members | 1,694 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,576 developers. It's quick & easy.

master detail datalist

I have a master detail datatable and add a relation
DataRelation relation = new DataRelation("PartNoRelation", Dt_Cart.Columns["PartNo"], Tbl_NearestCenters.Columns["PartNo"],false);
Ds_CartItem.Relations.Add(relation);
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"]);
Response.Write("=====================");

foreach(DataRow drTitle in drPublisher.GetChildRows("PartNoRelation"))
{
Response.Write(drTitle["WareHouseZipCode"]);
}
Response.Write("<br>");
it works good and shows just the related information for each master detail
why doesnt' it work in my data list? }

--
Sagdude
Nov 16 '05 #1
0 1115

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Demetri | last post: by
6 posts views Thread by Beren | last post: by
1 post views Thread by ultraweaver | last post: by
1 post views Thread by yoknows | last post: by
reply views Thread by Mike Wilson | last post: by
2 posts views Thread by John | last post: by
1 post views Thread by Salim | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.