Repeater的用法

 

          <asp:Repeater ID="Repeater_Price" runat="server" OnItemDataBound="Repeater_Price_ItemDataBound">
          <ItemTemplate>
            <tr bgcolor="white">
            <td style="height: 25px">&nbsp;<font color="red"><strong><asp:Label ID="labBigCategory" runat="server"></asp:Label></strong></font></td>
            <td style="height: 25px">&nbsp;<asp:Label ID="labSmallCategory" runat="server"></asp:Label></td>
            <td style="height: 25px">&nbsp;<asp:Label ID="labUnit" runat="server"></asp:Label></td>
            <td style="height: 25px">&nbsp;<asp:Label ID="labNum" runat="server"></asp:Label></td>
            <td style="height: 25px">&nbsp;<asp:Label ID="labPrice" runat="server"></asp:Label></td>
            <td style="height: 25px">&nbsp;<asp:Label ID="labTotalPrice" runat="server"></asp:Label></td>
            <td style="height: 25px">&nbsp;<asp:Label ID="labRemarks" runat="server"></asp:Label></td>
          </tr>
          </ItemTemplate>
          </asp:Repeater>

 

 

        this.Repeater_Price.DataSource = ServiceLocator.ProjectService.GetProjectPriceByProId(proId);
        this.Repeater_Price.DataBind();

 

    /// <summary>
    /// 初始化绑定
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Repeater_Price_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            ProjectPrice proPrice = (ProjectPrice)e.Item.DataItem;

            Label l_BigCategory = (Label)e.Item.FindControl("labBigCategory");
            l_BigCategory.Text = proPrice.ProjectBigCate;

            Label l_SmallCategory = (Label)e.Item.FindControl("labSmallCategory");
            l_SmallCategory.Text = proPrice.ProjectSmallCate;

            Label l_Unit = (Label)e.Item.FindControl("labUnit");
            l_Unit.Text = proPrice.Unit;

            Label l_Num = (Label)e.Item.FindControl("labNum");
            l_Num.Text = Convert.ToString(proPrice.Num);

            Label l_Price = (Label)e.Item.FindControl("labPrice");
            l_Price.Text =Convert.ToString(proPrice.ProjectCountPrice);

            Label l_TotalPrice = (Label)e.Item.FindControl("labTotalPrice");
            l_TotalPrice.Text = Convert.ToString(proPrice.ProjectCountPrice * proPrice.Num);

            Label l_Remarks = (Label)e.Item.FindControl("labRemarks");
            l_Remarks.Text = proPrice.Remarks;

        }
   
    } 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值