• 动态创建Repeater模板


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace Xys.Remp.WF.UI
    {
        public class WorkFlowTraceTemplate : ITemplate
        {
            ListItemType templateType;

            public WorkFlowTraceTemplate(ListItemType type)
            {
                templateType = type;
            }

            public void InstantiateIn(System.Web.UI.Control container)
            {
                Literal lc = new Literal();
                switch (templateType)
                {
                    case ListItemType.Header:
                        lc.Text = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" class=\"addformcontainer\"><tr><td>节点编号</td><td>节点名称</td><td>处理人</td><td>审批意见</td><td>时间</td></tr>";
                        break;
                    case ListItemType.Item:
                        lc.DataBinding += new EventHandler(TemplateControl_DataBinding);
                        break;
                        break;
                    case ListItemType.Footer:
                        lc.Text = "</table>";
                        break;
                }
                container.Controls.Add(lc);
            }

            private void TemplateControl_DataBinding(object sender,
    System.EventArgs e)
            {
                Literal lc;
                lc = (Literal)sender;
                RepeaterItem container = (RepeaterItem)lc.NamingContainer;
                lc.Text = "  <tr><td>" + DataBinder.Eval(container.DataItem, "NodeID") + "</td><td>" + DataBinder.Eval(container.DataItem, "NodeName") + "</td><td>" + DataBinder.Eval(container.DataItem, "CurrentPersonName") + "</td><td>" + DataBinder.Eval(container.DataItem, "Remark") + "</td><td>" + DataBinder.Eval(container.DataItem, "HandleTime") + "</td></tr>";
            }
        }
    }

  • 相关阅读:
    angular 路由动态加载JS文件
    使用AngularJS处理单选框和复选框的简单方法
    angularjs 请求后端接口请求了两次
    angular ui.router 路由传参数
    linux 安装svn服务器
    gulp css 压缩 合并
    ajax 实现跨域
    [codeforces 1366D] Two Divisors
    Namomo Test Round 1 题解
    Race(淀粉质)
  • 原文地址:https://www.cnblogs.com/50614090/p/2145399.html
Copyright © 2020-2023  润新知