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


C# Table.RenderControl方法代码示例

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


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

示例1: GetDesignTimeHtml

 public override string GetDesignTimeHtml()
 {
     var style = new TableStyle();
     var table = new Table();
     var component = Component as DeluxeSearch;
     var writer = new StringWriter();
     var html = new HtmlTextWriter(writer);
     if (null != component)
     {
         if (component.Categories.Count > 0)
         {
             foreach (var item in component.Categories)
             {
                 var cell = new TableCell();
                 var row = new TableRow();
                 cell.Text = string.Format("{0}:{1}", item.DataTextField, item.DataSourceID);
                 row.Cells.Add(cell);
                 table.Rows.Add(row);
             }
         }
         else
         {
             var cell = new TableCell();
             var row = new TableRow();
             cell.Text = component.ID;
             row.Cells.Add(cell);
             table.Rows.Add(row);
         }
         table.ApplyStyle(style);              
         table.RenderControl(html);
     }
     return writer.ToString();
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:33,代码来源:DeluxeSearchDesigner.cs

示例2: loadBoardTable

 // ReSharper restore MemberCanBePrivate.Global
 // ReSharper restore UnaccessedField.Global
 public void loadBoardTable(Table theTable)
 {
     TextWriter ourTextWriter2 = new StringWriter();
     HtmlTextWriter ourHtmlWriter2 = new HtmlTextWriter(ourTextWriter2);
     theTable.RenderControl(ourHtmlWriter2);
     newBoardHTML = ourTextWriter2.ToString();
 }
开发者ID:randomdude,项目名称:DoktorChess,代码行数:9,代码来源:moveResponse.cs

示例3: Export

        public static void Export(string fileName, GridView gv)
        {
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AddHeader(
            "content-disposition", string.Format("attachment; filename={0}", fileName));
            HttpContext.Current.Response.ContentType = "application/ms-excel";

            using (StringWriter sw = new StringWriter())
            {
                using (HtmlTextWriter htw = new HtmlTextWriter(sw))
                {
                    Table table = new Table();
                    if (gv.HeaderRow != null)
                    {
                        table.Rows.Add(gv.HeaderRow);
                    }

                    foreach (GridViewRow row in gv.Rows)
                    {
                        GridViewExportUtil.PrepareControlForExport(row);
                        table.Rows.Add(row);
                    }
                    if (gv.FooterRow != null)
                    {
                        GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
                        table.Rows.Add(gv.FooterRow);
                    }
                    table.RenderControl(htw);
                    HttpContext.Current.Response.Write(sw.ToString());
                    HttpContext.Current.Response.End();
                }
            }
        }
开发者ID:himanshujoshi19,项目名称:Test,代码行数:33,代码来源:GridViewExportUtil.cs

示例4: ExportExcell

        public static void ExportExcell(string fileName, GridView gv)
        {
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Buffer = true;

            HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", fileName));
            HttpContext.Current.Response.Charset = "";
            HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            Table tb = new Table();
            TableRow tr1 = new TableRow();
            TableCell cell1 = new TableCell();
            cell1.Controls.Add(gv);
            tr1.Cells.Add(cell1);

            TableCell cell2 = new TableCell();
            cell2.Text = " ";

            TableRow tr2 = new TableRow();
            tr2.Cells.Add(cell2);

            tb.Rows.Add(tr1);
            tb.Rows.Add(tr2);

            tb.RenderControl(hw);

            //style to format numbers to string
            string style = @"<style> .textmode { mso-number-format:\@; } </style>";
            HttpContext.Current.Response.Write(style);
            HttpContext.Current.Response.Output.Write(sw.ToString());
            HttpContext.Current.Response.Flush();
            HttpContext.Current.Response.End();
        }
开发者ID:manivts,项目名称:impexcubeapp,代码行数:35,代码来源:frmContractWiseReport.aspx.cs

示例5: Export

        public static void Export(string fileName, GridView gv, HttpResponse response)
        {
            gv.AllowPaging = false;
            gv.DataBind();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AddHeader(
                "content-disposition", string.Format("attachment; filename=" + fileName + ".xls"));
            HttpContext.Current.Response.Charset = "";
            HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";

            using (StringWriter sw = new StringWriter())
            {
                using (HtmlTextWriter htw = new HtmlTextWriter(sw))
                {
                    //  Create a form to contain the grid
                    Table table = new Table();

                    //  add the header row to the table
                    if (gv.HeaderRow != null)
                    {
                        PrepareControlForExport(gv.HeaderRow);
                        table.Rows.Add(gv.HeaderRow);
                    }

                    //  add each of the data rows to the table
                    foreach (GridViewRow row in gv.Rows)
                    {
                        PrepareControlForExport(row);
                        table.Rows.Add(row);
                    }

                    //  add the footer row to the table
                    if (gv.FooterRow != null)
                    {
                        PrepareControlForExport(gv.FooterRow);
                        table.Rows.Add(gv.FooterRow);
                    }

                    //  render the table into the htmlwriter
                    table.RenderControl(htw);

                    //  render the htmlwriter into the response
                    HttpContext.Current.Response.Write(sw.ToString());
                    HttpContext.Current.Response.Flush();
                    HttpContext.Current.Response.End();
                }
            }
        }
开发者ID:nakirareizo,项目名称:Training,代码行数:48,代码来源:GridViewExportUtility.cs

示例6: Render

 protected override void Render(HtmlTextWriter output)
 {
     double num4 = this.TableWidth.Value;
     double num = Math.Round((double) ((70.0 * num4) / 100.0));
     double num2 = Math.Round((double) ((this.Progress * num) / 100.0));
     double num3 = Math.Round((double) (num - num2));
     Table child = new Table();
     TableRow row = new TableRow();
     TableCell cell = new TableCell();
     child.CellPadding = 0;
     child.CellSpacing = 0;
     child.BorderWidth = 0;
     child.Width = Unit.Pixel((int) num);
     Image image = new Image();
     if (this.BarColor == null)
     {
         image.ImageUrl = GlobalConfig.ImagesPath + "bar/BarOn_red.gif";
     }
     else
     {
         image.ImageUrl = GlobalConfig.ImagesPath + "bar/BarOn_" + this.BarColor + ".gif";
     }
     image.Width = Unit.Pixel((int) num2);
     image.Height = 14;
     cell.Controls.Add(image);
     image = new Image();
     image.ImageUrl = GlobalConfig.ImagesPath + "bar/BarOff.gif";
     image.Width = Unit.Pixel((int) num3);
     image.Height = 14;
     cell.Controls.Add(image);
     row.ControlStyle.CopyFrom(this.ItemStyle);
     row.Cells.Add(cell);
     cell = new TableCell();
     if (this.Progress == 0)
     {
         cell.Text = "&nbsp;&nbsp;0%";
     }
     else
     {
         cell.Text = "&nbsp;&nbsp;" + this.Progress.ToString("##.##") + "%";
     }
     cell.HorizontalAlign = HorizontalAlign.Right;
     row.Cells.Add(cell);
     child.Controls.Add(row);
     this.Controls.Add(child);
     child.RenderControl(output);
 }
开发者ID:ChrisNelsonPE,项目名称:surveyproject_main_public,代码行数:47,代码来源:ResultsBar.cs

示例7: Export

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="gv"></param>
        public static void Export(string fileName, GridView gv)
        {
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AddHeader(
                "content-disposition", string.Format("attachment; filename={0}", fileName));
            HttpContext.Current.Response.ContentType = "application/ms-excel";

            using (StringWriter sw = new StringWriter())
            {
                using (HtmlTextWriter htw = new HtmlTextWriter(sw))
                {
                    //  Create a table to contain the grid
                    Table table = new Table();

                    //  include the gridline settings
                    table.GridLines = gv.GridLines;

                    //  add the header row to the table
                    if (gv.HeaderRow != null)
                    {
                        GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
                        table.Rows.Add(gv.HeaderRow);
                    }

                    //  add each of the data rows to the table
                    foreach (GridViewRow row in gv.Rows)
                    {
                        GridViewExportUtil.PrepareControlForExport(row);
                        table.Rows.Add(row);
                    }

                    //  add the footer row to the table
                    if (gv.FooterRow != null)
                    {
                        GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
                        table.Rows.Add(gv.FooterRow);
                    }

                    //  render the table into the htmlwriter
                    table.RenderControl(htw);

                    //  render the htmlwriter into the response
                    HttpContext.Current.Response.Write(sw.ToString());
                    HttpContext.Current.Response.End();
                }
            }
        }
开发者ID:JackyW83,项目名称:Test,代码行数:52,代码来源:GridViewExportUtil.cs

示例8: Render

 protected override void Render(HtmlTextWriter output)
 {
     double num4 = this.TableWidth.Value;
     double num = Math.Round((double) ((70.0 * num4) / 100.0));
     double num2 = Math.Round((double) ((this.RatingPercent * num) / 100.0));
     double num3 = Math.Round((double) (num - num2));
     Table child = new Table();
     TableRow row = new TableRow();
     TableRow row2 = new TableRow();
     TableCell cell = new TableCell();
     TableCell cell2 = new TableCell();
     TableCell cell3 = new TableCell();
     row2.ControlStyle.CopyFrom(this.ItemStyle);
     cell.ColumnSpan = 2;
     if (this.Rating == 0.0)
     {
         cell.Text = string.Format(ResourceManager.GetString("RatingResults"), this.Rating, this.MaxRating);
     }
     else
     {
         cell.Text = string.Format(ResourceManager.GetString("RatingResults"), this.Rating.ToString("##.##"), this.MaxRating);
     }
     row2.Cells.Add(cell);
     child.Rows.Add(row2);
     cell3.ControlStyle.Font.Size = FontUnit.XXSmall;
     cell3.Text = "&nbsp;" + this.MaxRating.ToString();
     child.CellPadding = 0;
     child.CellSpacing = 3;
     child.BorderWidth = 0;
     child.Width = Unit.Pixel((int) num);
     System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
     image.ImageUrl = GlobalConfig.ImagesPath + "PositiveRatingBar.gif";
     image.Width = Unit.Pixel((int) num2);
     image.Height = 12;
     cell2.Controls.Add(image);
     image = new System.Web.UI.WebControls.Image();
     image.ImageUrl = GlobalConfig.ImagesPath + "NegativeRatingBar.gif";
     image.Width = Unit.Pixel((int) num3);
     image.Height = 12;
     cell2.Controls.Add(image);
     row.ControlStyle.CopyFrom(this.ItemStyle);
     row.Cells.Add(cell2);
     row.Cells.Add(cell3);
     child.Controls.Add(row);
     this.Controls.Add(child);
     child.RenderControl(output);
 }
开发者ID:ChrisNelsonPE,项目名称:surveyproject_main_public,代码行数:47,代码来源:RatingBar.cs

示例9: Render

        //public
        /// <summary> 
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            if (Context.User.Identity.IsAuthenticated)
              {
            NdiMenuItem item0 =
              new NdiMenuItem(0, "Felhasználói adatok", "Felhasználói adatok", "UserData.aspx", "_images/userdataS.gif",
                          "_images/userdataL.gif");
            NdiMenuItem item1 =
              new NdiMenuItem(1, "Felhasználói adatok módosítása", "Felhasználói adatok módosítása", "UserDataModify.aspx",
                          "_images/userdataModS.gif",
                          "_images/userdataModL.gif");
            NdiMenuItem item2 =
              new NdiMenuItem(2, "Jelszó változtatás", "Jelszó változtatás", "UserPassword.aspx", "_images/passChangeS.gif",
                          "_images/passChangeL.gif");

            Table table = new Table();
            table.CellPadding = 0;
            table.CellSpacing = 0;
            table.CssClass = "almenu";
            TableRow row1 = new TableRow();

            TableCell cell0 = CreateCell(item0);

            TableCell cell2 = CreateCell(item2);
            TableCell cell1 = CreateCell(item1);

            table.Rows.Add(row1);
            row1.Cells.Add(cell0);

            row1.Cells.Add(cell1);
            row1.Cells.Add(cell2);
            table.Width = Unit.Percentage(100);

            table.RenderControl(output);
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:41,代码来源:MenuSettings.cs

示例10: CreateExcel_HTML

        public static System.IO.StringWriter CreateExcel_HTML(
            DataTable Dt
            , ClsExcel_Columns Columns)
        {
            System.IO.StringWriter Sw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter Htw = new System.Web.UI.HtmlTextWriter(Sw);
            System.Web.UI.WebControls.Table Tb = new System.Web.UI.WebControls.Table();

            System.Web.UI.WebControls.TableRow Tbr_Header = new System.Web.UI.WebControls.TableRow();
            foreach (ClsExcel_Columns.Str_Columns? Obj in Columns.pObj)
            {
                System.Web.UI.WebControls.TableCell Tbc = new System.Web.UI.WebControls.TableCell();
                Tbc.Text = Obj.Value.FieldDesc;
                Tbr_Header.Cells.Add(Tbc);
            }

            Tb.Rows.Add(Tbr_Header);

            foreach (DataRow Dr in Dt.Rows)
            {
                System.Web.UI.WebControls.TableRow Tbr = new System.Web.UI.WebControls.TableRow();
                foreach (ClsExcel_Columns.Str_Columns? Obj in Columns.pObj)
                {
                    System.Web.UI.WebControls.TableCell Tbc = new System.Web.UI.WebControls.TableCell();
                    Tbc.Text = Dr[Obj.Value.FieldName].ToString();
                    Tbr.Cells.Add(Tbc);
                }
                Tb.Rows.Add(Tbr);
            }
            Tb.RenderControl(Htw);
            return Sw;
        }
开发者ID:kolinlocke,项目名称:WebApplication_DoTest,代码行数:32,代码来源:Layer01_Methods_Web.cs

示例11: GeneratePagerLinks


//.........这里部分代码省略.........
            previousColumn.Controls.Add(ulFirstElement);
            mainTableRow.Cells.Add(previousColumn);

            // Second Page Numbers Column
            var ulSecondElement = new HtmlGenericControl("ul");

            var pageNumbersColumn = new TableCell { CssClass = "PagerNumbersColumn", HorizontalAlign = HorizontalAlign.Center };

            ulSecondElement.Attributes.Add("class", "FilesPager");

            for (int i = iStart; i < iEnd; i++)
            {
                var liElement = new HtmlGenericControl("li");

                liElement.Attributes.Add("class", i.Equals(this.CurrentPageIndex) ? "ActivePage" : "NormalPage");

                var page = (i + 1).ToString();

                var pageLink = new HyperLink
                {
                    ID = string.Format("NextPageLink{0}", page),
                    ToolTip = string.Format("{0}: {1}", Localization.GetString("GoTo.Text", this.RessourceFile, this.LanguageCode), page),
                    Text = page,
                    NavigateUrl =
                        this.Page.ClientScript.GetPostBackClientHyperlink(this, string.Format("Page_{0}", i), false)
                };

                liElement.Controls.Add(pageLink);

                ulSecondElement.Controls.Add(liElement);
            }

            // Add Column
            pageNumbersColumn.Controls.Add(ulSecondElement);
            mainTableRow.Cells.Add(pageNumbersColumn);

            // Last Page Column
            var ulThirdElement = new HtmlGenericControl("ul");

            ulThirdElement.Attributes.Add("class", "FilesPager");

            var lastColumn = new TableCell { CssClass = "PagerLastColumn" };

            // Next Page
            if (this.CurrentPageIndex < (this.PageCount - 1))
            {
                var liNextElement = new HtmlGenericControl("li");

                liNextElement.Attributes.Add("class", "NextPage");

                var lastNextLink = new HyperLink
                {
                    ID = "NextPageLink",
                    ToolTip = string.Format("{0}{1}", Localization.GetString("GoTo.Text", this.RessourceFile, this.LanguageCode), Localization.GetString("NextPage.Text", this.RessourceFile, this.LanguageCode)),
                    Text = string.Format("{0} &gt;", Localization.GetString("NextPage.Text", this.RessourceFile, this.LanguageCode)),
                    NavigateUrl =
                        this.Page.ClientScript.GetPostBackClientHyperlink(
                            this, string.Format("Page_{0}", (this.CurrentPageIndex + 2 - 1)), false)
                };

                liNextElement.Controls.Add(lastNextLink);

                ulThirdElement.Controls.Add(liNextElement);
            }

            if (iEnd < this.PageCount)
            {
                var liLastElement = new HtmlGenericControl("li");

                liLastElement.Attributes.Add("class", "LastPage");

                var lastPageLink = new HyperLink
                {
                    ID = "LastPageLink",
                    ToolTip =
                        string.Format(
                            "{0}{1}",
                            Localization.GetString("GoTo.Text", this.RessourceFile, this.LanguageCode),
                            Localization.GetString("LastPage.Text", this.RessourceFile, this.LanguageCode)),
                    Text =
                        string.Format(
                            "{0} &raquo;",
                            Localization.GetString("LastPage.Text", this.RessourceFile, this.LanguageCode)),
                    NavigateUrl =
                        this.Page.ClientScript.GetPostBackClientHyperlink(
                            this, string.Format("Page_{0}", (this.PageCount - 1)), false)
                };

                liLastElement.Controls.Add(lastPageLink);

                ulThirdElement.Controls.Add(liLastElement);
            }

            // Add Column
            lastColumn.Controls.Add(ulThirdElement);
            mainTableRow.Cells.Add(lastColumn);

            // Render Complete Control
            mainTable.RenderControl(writer);
        }
开发者ID:ohine,项目名称:CKEditorProvider,代码行数:101,代码来源:Pager.cs

示例12: ExportToExcel

 public static void ExportToExcel(string fileName, List<Listing> AdminList)
 {
     //The Clear method erases any buffered HTML output.
     HttpContext.Current.Response.Clear();
     //The AddHeader method adds a new HTML header and value to the response sent to the client.
     HttpContext.Current.Response.AddHeader(
          "content-disposition", string.Format("attachment; filename={0}", fileName + ".xls"));
     //The ContentType property specifies the HTTP content type for the response.
     HttpContext.Current.Response.ContentType = "application/ms-excel";
     //Implements a TextWriter for writing information to a string. The information is stored in an underlying StringBuilder.
     using (StringWriter sw = new StringWriter())
     {
         //Writes markup characters and text to an ASP.NET server control output stream. This class provides formatting capabilities that ASP.NET server controls use when rendering markup to clients.
         using (HtmlTextWriter htw = new HtmlTextWriter(sw))
         {
             //  Create a form to contain the List
             Table table = new Table();
             TableRow row = new TableRow();
             foreach (PropertyInfo proinfo in new Listing().GetType().GetProperties())
             {
                 TableHeaderCell hcell = new TableHeaderCell();
                 hcell.Text = proinfo.Name;
                 row.Cells.Add(hcell);
             }
             table.Rows.Add(row);
             //  add each of the data item to the table
             foreach (Listing lst in AdminList)
             {
                 TableRow row1 = new TableRow();
                 TableCell cellStaffID = new TableCell();
                 cellStaffID.Text = "" + lst.StaffID;
                 TableCell cellStaffName = new TableCell();
                 cellStaffName.Text = "" + lst.StaffName;
                 TableCell cellSuperName = new TableCell();
                 cellSuperName.Text = "" + lst.SupervisorName;
                 TableCell cellType = new TableCell();
                 cellType.Text = "" + lst.ApplicationType;
                 TableCell cellTitle = new TableCell();
                 cellTitle.Text = "" + lst.Title;
                 TableCell cellDate = new TableCell();
                 cellDate.Text = "" + lst.DateRequest;
                 TableCell cellStatus = new TableCell();
                 cellStatus.Text = "" + lst.Status;
                 TableCell cellSAP = new TableCell();
                 cellSAP.Text = "" + lst.PostedSAPStatus;
                 row1.Cells.Add(cellStaffID);
                 row1.Cells.Add(cellStaffName);
                 row1.Cells.Add(cellSuperName);
                 row1.Cells.Add(cellType);
                 row1.Cells.Add(cellTitle);
                 row1.Cells.Add(cellDate);
                 row1.Cells.Add(cellStatus);
                 row1.Cells.Add(cellSAP);
                 table.Rows.Add(row1);
             }
             //  render the table into the htmlwriter
             table.RenderControl(htw);
             //  render the htmlwriter into the response
             HttpContext.Current.Response.Write(sw.ToString());
             HttpContext.Current.Response.Flush();
             HttpContext.Current.Response.End();
         }
     }
 }
开发者ID:nakirareizo,项目名称:Training,代码行数:64,代码来源:GridViewExportUtility.cs

示例13: RenderErrors

        private void RenderErrors(HtmlTextWriter writer)
        {
            Debug.Assert(writer != null);

            //
            // Create a table to display error information in each row.
            //

            Table table = new Table();
            table.ID = "ErrorLog";
            table.CellSpacing = 0;

            //
            // Create the table row for headings.
            //

            TableRow headRow = new TableRow();

            headRow.Cells.Add(FormatCell(new TableHeaderCell(), "Host", "host-col"));
            headRow.Cells.Add(FormatCell(new TableHeaderCell(), "Code", "code-col"));
            headRow.Cells.Add(FormatCell(new TableHeaderCell(), "Type", "type-col"));
            headRow.Cells.Add(FormatCell(new TableHeaderCell(), "Error", "error-col"));
            headRow.Cells.Add(FormatCell(new TableHeaderCell(), "User", "user-col"));
            headRow.Cells.Add(FormatCell(new TableHeaderCell(), "Date", "date-col"));
            headRow.Cells.Add(FormatCell(new TableHeaderCell(), "Time", "time-col"));

            table.Rows.Add(headRow);

            //
            // Generate a table body row for each error.
            //

            for (int errorIndex = 0; errorIndex < _errorEntryList.Count; errorIndex++)
            {
                ErrorLogEntry errorEntry = (ErrorLogEntry) _errorEntryList[errorIndex];
                Error error = errorEntry.Error;

                TableRow bodyRow = new TableRow();
                bodyRow.CssClass = errorIndex % 2 == 0 ? "even-row" : "odd-row";

                //
                // Format host and status code cells.
                //

                bodyRow.Cells.Add(FormatCell(new TableCell(), error.HostName, "host-col"));
                bodyRow.Cells.Add(FormatCell(new TableCell(), error.StatusCode.ToString(), "code-col", Mask.NullString(HttpWorkerRequest.GetStatusDescription(error.StatusCode))));
                bodyRow.Cells.Add(FormatCell(new TableCell(), ErrorDisplay.HumaneExceptionErrorType(error), "type-col", error.Type));

                //
                // Format the message cell, which contains the message
                // text and a details link pointing to the page where
                // all error details can be viewed.
                //

                TableCell messageCell = new TableCell();
                messageCell.CssClass = "error-col";

                Label messageLabel = new Label();
                messageLabel.Text = this.Server.HtmlEncode(error.Message);

                HyperLink detailsLink = new HyperLink();
                detailsLink.NavigateUrl = BasePageName + "/detail?id=" + HttpUtility.UrlEncode(errorEntry.Id);
                detailsLink.Text = "Details&hellip;";

                messageCell.Controls.Add(messageLabel);
                messageCell.Controls.Add(new LiteralControl(" "));
                messageCell.Controls.Add(detailsLink);

                bodyRow.Cells.Add(messageCell);

                //
                // Format the user, date and time cells.
                //

                bodyRow.Cells.Add(FormatCell(new TableCell(), error.User, "user-col"));
                bodyRow.Cells.Add(FormatCell(new TableCell(), error.Time.ToShortDateString(), "date-col",
                    error.Time.ToLongDateString()));
                bodyRow.Cells.Add(FormatCell(new TableCell(), error.Time.ToShortTimeString(), "time-col",
                    error.Time.ToLongTimeString()));

                //
                // Finally, add the row to the table.
                //

                table.Rows.Add(bodyRow);
            }

            table.RenderControl(writer);
        }
开发者ID:buddydvd,项目名称:elmah-mirror,代码行数:89,代码来源:ErrorLogPage.cs

示例14: RenderWeekTable

        private void RenderWeekTable(List<TaskData> lstTasks)
        {
            Table tblInfoCallender = new Table();

            string[] dayLabels = EnumDay.getDaysOfTheWeek();

            TableRow tableHRow = new TableRow();
            for (int iCell = 0; iCell < 8; iCell++)
            {
                TableCell tableCell = new TableCell();

                if(iCell>0){
                    Label label = new Label();
                    label.Text = dayLabels[iCell-1];
                    tableCell.Controls.Add(label);
                }

                 tableHRow.Cells.Add(tableCell);
            }
            tblInfoCallender.Rows.Add(tableHRow);

            //Make the rows
            for (int iRow = 0; iRow < 24; iRow++)
            {
                TableRow tableRow = new TableRow();

                for(int iCell=0; iCell < 8; iCell++){
                    TableCell tableCell = new TableCell();
                    if (iCell == 0)
                    {
                        Label lblHour = new Label();
                        lblHour.Text = iRow + ":00";
                        tableCell.Controls.Add(lblHour);
                        tableCell.CssClass = "hour";
                    }
                    else
                    {
                        Label lblId = new Label();
                        lblId.ID = "lblId" + iRow.ToString() + iCell.ToString();
                        lblId.Text = "";
                        tableCell.Controls.Add(lblId);
                        tableCell.CssClass = "calendarCell";
                    }
                    tableRow.Cells.Add(tableCell);
                }
                tblInfoCallender.Rows.Add(tableRow);
            }

            DateTime now = DateTime.Now;

            for(int i=0;i<lstTasks.Count;i++){
                TaskData data = lstTasks[i];

                //Check the day
                TableCell tableCell = null;
                switch (data.Repeat)
                {
                    case (int)EnumSchedule.Task.Once:
                        tableCell = tblInfoCallender.Rows[data.Date.Hour+1].Cells[(int)data.Date.DayOfWeek];
                        tableCell.BackColor = (Color)System.Drawing.ColorTranslator.FromHtml("#d41926");
                        createTaskImageButton(tableCell, data,i);
                        //RenderInfoCell(tableCell, data);
                    break;
                    case (int)EnumSchedule.Task.Dailey:
                        for (int iDayOfWeek = 1; iDayOfWeek < 8; iDayOfWeek++)
                        {
                            tableCell = tblInfoCallender.Rows[data.Date.Hour + 1].Cells[iDayOfWeek];
                            tableCell.BackColor = (Color)System.Drawing.ColorTranslator.FromHtml("#a19f9f");
                            createTaskImageButton(tableCell, data, i + 100 + iDayOfWeek);
                            //RenderInfoCell(tableCell, data);
                        }
                    break;
                    case (int)EnumSchedule.Task.Weekley:
                        tableCell = tblInfoCallender.Rows[data.Date.Hour+1].Cells[(int)data.RepeatDayOftheWeek+1];
                        tableCell.BackColor = (Color)System.Drawing.ColorTranslator.FromHtml("#a19f9f");
                        createTaskImageButton(tableCell, data,i);
                        //RenderInfoCell(tableCell, data);
                    break;
                    case (int)EnumSchedule.Task.Monthly:
                        DateTime monthTime = new DateTime(now.Year,now.Month,(int)data.RepeatDay);
                        tableCell = tblInfoCallender.Rows[data.Date.Hour + 1].Cells[(int)monthTime.DayOfWeek + 1];
                        tableCell.BackColor = (Color)System.Drawing.ColorTranslator.FromHtml("#a19f9f");
                        createTaskImageButton(tableCell, data,i);
                        //RenderInfoCell(tableCell, data);
                    break;
                    case (int)EnumSchedule.Task.Annually:
                        DateTime yearTime = new DateTime(now.Year, (int)data.RepeatMonth, (int)data.RepeatDay);
                        tableCell = tblInfoCallender.Rows[data.Date.Hour + 1].Cells[(int)yearTime.DayOfWeek + 1];
                        tableCell.BackColor = (Color)System.Drawing.ColorTranslator.FromHtml("#a19f9f");
                        createTaskImageButton(tableCell, data,i);
                        //RenderInfoCell(tableCell,data);
                    break;
                }
            }

            TextWriter textWriter = new StringWriter();
            HtmlTextWriter htmlTextWriter = new HtmlTextWriter(textWriter);
            tblInfoCallender.RenderControl(htmlTextWriter);
            containerCalendar.InnerHtml = textWriter.ToString();
        }
开发者ID:PieterTaelman,项目名称:BackupProject,代码行数:100,代码来源:Planning.aspx.cs

示例15: RenderTable

 private void RenderTable(HttpContext context, Table table)
 {
     StringWriter writer1 = new StringWriter();
     HtmlTextWriter writer2 = new HtmlTextWriter(writer1);
     table.RenderControl(writer2);
     context.Response.Write("<div class='tableDetail'>");
     context.Response.Write(writer1.ToString());
     context.Response.Write("</div>");
 }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:9,代码来源:CacheHandler.cs


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