• C# Repeater 嵌套


     <table class="table table-bordered table-fixed">
                        <thead>
                            <tr>
                                <th width="40">
                                    <input type="checkbox" id="chkAll" onclick="selectAll()" /></th>
                                <th width="60" class="text-center"><%=Resources.Asset.DictViewRowIndex%></th>
                                <th width="280"><%=Resources.Asset.UserDepartments%></th>
                                <th width="120"><%=Resources.Asset.AssetCategory%></th>
                                <th width="120"><%=Resources.Asset.AssetSubClass%></th>
                                <th width="300"><%=Resources.Asset.AssetsCompany%></th>
                                <th width="120"><%=Resources.Asset.AssetName%></th>
                                <th width="80"><%=Resources.Asset.AssetsState%></th>
                                <th width="100">数量</th>
                                <th width="100">原值</th>
                            </tr>
                        </thead>
                        <tbody>
                            <asp:Repeater ID="rptDept" runat="server" OnItemDataBound="rptDept_ItemDataBound">
                                <ItemTemplate>
                                    <tr>
                                        <td>
                                            <input type="checkbox" class="assetId" id='<%#((iWS.Assets.DB.Asset)Container.DataItem).Id%>' onclick="SelectSingle();" /></td>
                                        <td class="text-center"><%# Container.ItemIndex + 1 + (this.pagerControl.CurrentPageIndex -1) * this.pagerControl.PageSize%></td>
                                        <td><%#((iWS.Assets.DB.Asset)Container.DataItem).Owner!=null?((iWS.Assets.DB.Asset)Container.DataItem).Owner.Depts:"" %></td>
                                        <td colspan="7" style="padding: 0;">
                                            <table style="border: none;  100%;">
                                                <asp:Repeater ID="rptDeptSub" runat="server">
                                                    <ItemTemplate>
                                                        <tr>
                                                            <td><%#((iWS.Assets.DB.Asset)Container.DataItem).MainCategory!=null?((iWS.Assets.DB.Asset)Container.DataItem).MainCategory.Name:"" %></td>
                                                            <td><%#((iWS.Assets.DB.Asset)Container.DataItem).SubCategory!=null?((iWS.Assets.DB.Asset)Container.DataItem).SubCategory.Name:"" %></td>
                                                            <td><%#((iWS.Assets.DB.Asset)Container.DataItem).Company%></td>
                                                            <td><%#((iWS.Assets.DB.Asset)Container.DataItem).Name%></td>
                                                            <td><%#((iWS.Assets.DB.Asset)Container.DataItem).State!=null?((iWS.Assets.DB.Asset)Container.DataItem).State.Name:"" %></td>
                                                            <td><%#((iWS.Assets.DB.Asset)Container.DataItem).Number%></td>
                                                            <td><%#((iWS.Assets.DB.Asset)Container.DataItem).Cost%></td>
                                                        </tr>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </table>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                        </tbody>
                    </table>
      protected void rptDept_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
            {
                try
                {
                    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                    {
                        Repeater rep = e.Item.FindControl("rptCarryoverMsgSub") as Repeater;//找到repeater对象
                        DataRowView rowv = (DataRowView)e.Item.DataItem;
                        string fina = rowv["FinacialCode"] + "";//获取关联的流程ID
                        string proj = rowv["ProjName"] + "";//获取关联的流程ID
                        string yewu = rowv["YeWuSuo"] + "";//获取关联的流程ID
    
                        var query = from r in carryoverDt.AsEnumerable()
                                    where r.Field<string>("FinacialCode").Equals(fina) && r.Field<string>("ProjName").Equals(proj) && r.Field<string>("YeWuSuo").Equals(yewu)
                                    select new
                                    {
                                        CarryoverName = r.Field<string>("CarryoverName"),
                                        Account = r.Field<decimal>("Account"),
                                        SubDebt = r.Field<decimal>("SubDebt"),
                                        TotalInCome = r.Field<decimal>("TotalInCome"),
                                        HistoryInCome = r.Field<decimal>("HistoryInCome"),
                                        CurrentInCome = r.Field<decimal>("CurrentInCome"),
                                        LastCarryoverToCurrentInCome = r.Field<decimal>("LastCarryoverToCurrentInCome"),
                                        TotalCarryover = r.Field<decimal>("TotalCarryover"),
                                        HistoryCarryover = r.Field<decimal>("HistoryCarryover"),
                                        CurrentCarryover = r.Field<decimal>("CurrentCarryover"),
                                        CurrentFinalBalance = r.Field<decimal>("CurrentFinalBalance"),
                                        CurrentOutCome = r.Field<decimal>("CurrentOutCome"),
                                        OutComeCanCarryover = r.Field<decimal>("OutComeCanCarryover"),
                                        Progess = r.Field<int>("Progess"),
                                        ProgressCanCarryover = r.Field<decimal>("ProgressCanCarryover"),
                                        ThisCarryover = r.Field<decimal>("ThisCarryover")
                                    };
                        DataTable dt = DataTableHelper.ToDataTable(query.ToList());
                        rep.DataSource = dt;
                        rep.DataBind();
                    }
                }
                catch (Exception ex)
                {
                    DiskLog.LogError("ImplementAsyncData-rptAchiveData_ItemDataBound", ex);
                }
            }
  • 相关阅读:
    RSDS pdb格式
    关于windbg报错"No symbols for ntdll. Cannot continue."问题
    WinDbg常用命令系列---.cmdtree
    正确创建本地C++发布构建PDBS
    PDB文件会影响性能吗?
    每个开发人员必须知道PDB文件知识
    Windbg妙用
    在x64计算机上捕获32位进程的内存转储
    为什么我的堆栈上会有奇怪的函数名?(关于符号的讨论)
    redis入门基础
  • 原文地址:https://www.cnblogs.com/lishidefengchen/p/5599984.html
Copyright © 2020-2023  润新知