当前位置: 首页>>代码示例>>C#>>正文


C# HtmlTableCell.RenderControl方法代码示例

本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlTableCell.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTableCell.RenderControl方法的具体用法?C# HtmlTableCell.RenderControl怎么用?C# HtmlTableCell.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.HtmlControls.HtmlTableCell的用法示例。


在下文中一共展示了HtmlTableCell.RenderControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderReportEntities

        private List<HtmlTable> RenderReportEntities()
        {
            List<HtmlTable> tables = new List<HtmlTable>();
            Dictionary<Type, HashSet<DomainEntityBase>> entitiesDumped = new Dictionary<Type, HashSet<DomainEntityBase>>();
            HtmlTable table;
            HtmlTableRow row;
            HtmlTableCell cell;

            //
            // Group all the entities into their respective types
            //
            TreeWalker.Walk(_provider, ctx =>
            {
                HashSet<DomainEntityBase> set;
                if (!entitiesDumped.TryGetValue(ctx.Entity.GetType(), out set))
                {
                    entitiesDumped.Add(ctx.Entity.GetType(), set = new HashSet<DomainEntityBase>());
                }

                if (!set.Contains(ctx.Entity))
                {
                    set.Add(ctx.Entity);
                }
            });

            //
            // For each entity type, assign out the names
            //
            NameDomainEntities(entitiesDumped);

            foreach (var kv in entitiesDumped.Where(y => y.Value.Count() > 0).OrderBy(x => x.Key.Name))
            {
                var propvalues = from p in kv.Key.GetProperties()
                                 from e in kv.Value.OrderBy(x => x.ReportName)
                                 let prettySettings = p.GetCustomAttributes(typeof(PrettyPrintSettingsAttribute), true).FirstOrDefault() as PrettyPrintSettingsAttribute
                                 orderby (prettySettings != null ? prettySettings.DisplayOrdinal : 50), p.Name
                                 group new
                                 {
                                     Entity = e,
                                     Value = RenderReportValue(e, p)
                                 } by p;

                tables.Add(table = new HtmlTable());
                table.Attributes.Add("class", "entity");

                //
                // Make the header row pwease.
                //
                table.Rows.Add(row = new HtmlTableRow());
                row.Attributes.Add("class", "header");
                row.Cells.Add(new HtmlTableCell()
                {
                    InnerText = kv.Key.Name
                });

                //
                // Make the entity names
                //
                foreach (var v in propvalues.First())
                {
                    row.Cells.Add(cell = RenderEntityName(v.Entity));
                }

                //
                // Make the value rows
                //
                bool even = false;
                foreach (var entry in propvalues)
                {
                    PropertyInfo pi = entry.Key;
                    even = !even;

                    table.Rows.Add(row = new HtmlTableRow());
                    row.Attributes.Add("class", even ? "d0" : "d1");

                    //
                    // Render the property name
                    //
                    row.Cells.Add(cell = new HtmlTableCell());
                    cell.InnerText = pi.Name;
                    cell.Attributes.Add("class", "property_name");

                    HtmlTableCell previousCell = null;
                    string htmlPreviousCell = null;
                    string htmlCurrentCell = null;

                    foreach (var v in entry)
                    {
                        cell = v.Value;
                        htmlCurrentCell = null;

                        using (MemoryStream ms = new MemoryStream())
                        {
                            HtmlTextWriter writer = new HtmlTextWriter(new StreamWriter(ms));
                            StreamReader reader = new StreamReader(ms);
                            cell.RenderControl(writer);
                            writer.Flush();
                            ms.Position = 0;
                            htmlCurrentCell = reader.ReadToEnd();
                        }
//.........这里部分代码省略.........
开发者ID:amyhickman,项目名称:RapidAgencyDevelopment,代码行数:101,代码来源:SqlScript.cs


注:本文中的System.Web.UI.HtmlControls.HtmlTableCell.RenderControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。