How to use AlternatingItemTemplate in a Nested Repeater Control? You can see that the second row under case QTY 2 and 1 is not displayed. Please do not care about the data displayed.
I have also attached the code along with this email for reference.
Thank you very much!
| CASE QTY | SERVICE CODE | DESCRIPTION | CONTAINER | UNIT / CASE | UNIT PRICE | CASE PRICE | EXT. AMOUNT | EST DLVRY DATE |
|---|---|---|---|---|---|---|---|---|
| 1 | 2k1111 | 100ml Sodium | 70 ml 10 Ml Med Cass Res | 24 | $11.16 | $55.79 | $78 | 07/12/2006 |
| 2k8199 | Chloride | 50 cc short | 5 | $29 | $70 | $70 | ||
| 2 | 2k2222 | 250 ml Vflx | 5ml 60 cc BD Syringe | 5 | $8.05 | $40 | $40 | 07/13/2006 |
| 3 | 2k3333 | 0.9% Sodium Chloride 55ml | 60cc 250 ml Dextrose | 22 | $9 | $216 | $53 | 07/03/2006 |
| 2k8188 | Flouride | 10ml cal | 5 | $17 | $40 | $40 | ||
| 1 | 2k1111 | 100ml Sodium | 150ml 10 Ml Red | 24 | $11.20 | $56.80 | $78 | 07/26/2006 |
-------------------------------------------------------------------------------------------------------------------
CASE QTY | SERVICE CODE | DESCRIPTION | CONTAINER | UNIT / CASE | UNIT PRICE | CASE PRICE | EXT. AMOUNT | EST DLVRY DATE |
|---|---|---|---|---|---|---|---|---|
| <%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_QUANTITY") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_CATALOG_NO") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_CONFIGURATION_DESC") %> | <%# DataBinder._Eval(Container.DataItem, "CONTAINER_VOLUME") %> <%# DataBinder._Eval(Container.DataItem, "CONTAINER_TYPE") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_PACK_FACTOR") %> | $<%# DataBinder._Eval(Container.DataItem, "DRUG_UNIT_PRICE") %> | $<%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_PRICE") %> | $<%# DataBinder._Eval(Container.DataItem, "DRUG_EXTENDED_AMOUNT") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_ESTIMATED_DELIVERY_DT") %> |
| <%# DataBinder._Eval(Container.DataItem, "CASS_ITEMNBR")%> | <%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_DESCRIPTION")%> | <%# DataBinder._Eval(Container.DataItem, "CASS_COMPONENT_SHORT_DESC")%> | <%# DataBinder._Eval(Container.DataItem, "CASS_QTY_PER_CASE")%> | $<%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_UNIT_PRICE")%> | $<%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_CASE_PRICE")%> | $<%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_EXTENDED_AMOUNT") %> | ||
| <%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_QUANTITY") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_CATALOG_NO") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_CONFIGURATION_DESC") %> | <%# DataBinder._Eval(Container.DataItem, "CONTAINER_VOLUME") %> <%# DataBinder._Eval(Container.DataItem, "CONTAINER_TYPE") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_PACK_FACTOR") %> | $<%# DataBinder._Eval(Container.DataItem, "DRUG_UNIT_PRICE") %> | $<%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_PRICE") %> | $<%# DataBinder._Eval(Container.DataItem, "DRUG_EXTENDED_AMOUNT") %> | <%# DataBinder._Eval(Container.DataItem, "DRUG_ESTIMATED_DELIVERY_DT") %> |
----------------------------------------------------------
Form Load()
{
DataSet ds =
new DataSet();ds.Tables.Add(dt1);
ds.Tables.Add(dt2);
ds.Relations.Add("NestThem",ds.Tables[0].Columns["CASSITEMNMBR"], ds.Tables[1].Columns["CASS_ITEMNBR"]);
this.myRepeater.DataSource = ds; this.myRepeater.DataBind();}
public
void myRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e){
DataRowView drv = e.Item.DataItem
as DataRowView; if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item || drv != null ){
Repeater innerRep = e.Item.FindControl("NestedRepeater")
as Repeater; if(innerRep != null){
innerRep.DataSource = drv.CreateChildView("NestThem");
innerRep.DataBind();
}
}
}
Replies
Know the answer? Post it — somebody with the same question will find it here.