urpalshu

urpalshu

  • NA
  • 3
  • 0

Nested Repeater Control Question????

Jun 25 2006 8:55 AM
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
-------------------------------------------------------------------------------------------------------------------
 
 <!-- start parent repeater -->
  <asp:repeater id="myRepeater" Runat="server" onfiltered= "myRepeater_ItemDataBound">
   <HeaderTemplate>
    <table bgcolor="#097992" border="0" bordercolor="white" cellspacing="0" width="100%" height="20px" style="POSITION: relative; TOP: 0px; FONT-WEIGHT: bold; FONT-SIZE: 10px; FONT-FAMILY: Arial">
     <tr bgcolor="#097992" style="COLOR: white" height="24px">
      <th width="4%">
       CASE QTY</th>
      <th width="6%">
       SERVICE CODE</th>
      <th width="*%">
       DESCRIPTION</th>
      <th width="8%">
       CONTAINER</th>
      <th width="6%">
       UNIT / CASE</th>
      <th width="6%">
       UNIT PRICE</th>
      <th width="6%">
       CASE PRICE</th>
      <th width="6%">
       EXT. AMOUNT</th>
      <th width="8%">
       EST DLVRY DATE</th>
     </tr>
   </HeaderTemplate>
   <ItemTemplate>
    <tr bgcolor="White" height="24px">
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_QUANTITY") %></td>
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_CATALOG_NO") %></td>
     <td><%# DataBinder._Eval(Container.DataItem, "DRUG_CONFIGURATION_DESC") %></td>
     <td><%# DataBinder._Eval(Container.DataItem, "CONTAINER_VOLUME") %>
      <%# DataBinder._Eval(Container.DataItem, "CONTAINER_TYPE") %>
     </td>
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_PACK_FACTOR") %></td>
     <td align="center">$<%# DataBinder._Eval(Container.DataItem, "DRUG_UNIT_PRICE") %></td>
     <td align="center">$<%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_PRICE") %></td>
     <td align="center">$<%# DataBinder._Eval(Container.DataItem, "DRUG_EXTENDED_AMOUNT") %>
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_ESTIMATED_DELIVERY_DT") %></td>
    </tr>
    <!-- start child repeater -->
    <asp:repeater id="NestedRepeater" runat="server" >
     <itemtemplate>
      <tr bgcolor="White" height="24px">
       <td></td>
       <td align="center"><%# DataBinder._Eval(Container.DataItem, "CASS_ITEMNBR")%></td>
       <td><%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_DESCRIPTION")%></td>
       <td><%# DataBinder._Eval(Container.DataItem, "CASS_COMPONENT_SHORT_DESC")%></td>
       <td align="center"><%# DataBinder._Eval(Container.DataItem, "CASS_QTY_PER_CASE")%></td>
       <td align="center">$<%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_UNIT_PRICE")%></td>
       <td align="center">$<%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_CASE_PRICE")%></td>
       <td align="center">$<%# DataBinder._Eval(Container.DataItem, "CASS_DRUG_EXTENDED_AMOUNT") %>
       <td></td>
      </tr>
     </itemtemplate>
          
    </asp:repeater>
       </ItemTemplate>
   <AlternatingItemTemplate>
    <tr bgcolor="#e4e4e4" height="24px">
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_QUANTITY") %></td>
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_CATALOG_NO") %></td>
     <td><%# DataBinder._Eval(Container.DataItem, "DRUG_CONFIGURATION_DESC") %></td>
     <td><%# DataBinder._Eval(Container.DataItem, "CONTAINER_VOLUME") %>
      <%# DataBinder._Eval(Container.DataItem, "CONTAINER_TYPE") %>
     </td>
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_PACK_FACTOR") %></td>
     <td align="center">$<%# DataBinder._Eval(Container.DataItem, "DRUG_UNIT_PRICE") %></td>
     <td align="center">$<%# DataBinder._Eval(Container.DataItem, "DRUG_CASE_PRICE") %></td>
     <td align="center">$<%# DataBinder._Eval(Container.DataItem, "DRUG_EXTENDED_AMOUNT") %>
     <td align="center"><%# DataBinder._Eval(Container.DataItem, "DRUG_ESTIMATED_DELIVERY_DT") %></td>
    </tr>
   </AlternatingItemTemplate>
   <FooterTemplate>
    </table>
   </FooterTemplate>
  </asp:repeater>
----------------------------------------------------------
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();

}

}

}