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


C# UI.HtmlTextWriter类代码示例

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


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

示例1: Boton_Excel_Dios_Click

        protected void Boton_Excel_Dios_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            Page page = new Page();
            HtmlForm form = new HtmlForm();
            GridView_Dios.DataSourceID = string.Empty;
            GridView_Dios.EnableViewState = false;
            GridView_Dios.AllowPaging = false;
            GridView_Dios.DataSource = LBPD.Logica_Mostrar_Precios();
            GridView_Dios.DataBind();
            page.EnableEventValidation = false;
            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(GridView_Dios);
            page.RenderControl(htw);
            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "applicattion/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=data.xls");
            Response.Charset = "UTF-8";
            Response.ContentEncoding = Encoding.Default;
            Response.Write(sb.ToString());
            Response.End();
        }
开发者ID:Gutylic,项目名称:Proyecto-Alfa,代码行数:27,代码来源:Precios_Dios.aspx.cs

示例2: Render

 protected override void Render(HtmlTextWriter writer)
 {
     Literal itmCaption = new Literal();
     itmCaption.Text = "<label for=\"" + this.ClientID + "\" class=\"" + this.CaptionCssClass + "\">" + this.Caption + "</label>";
     itmCaption.RenderControl(writer);
     base.Render(writer);
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:7,代码来源:BindableTextArea.cs

示例3: AccordionHtml

 /// <summary>
 /// Accordions the HTML.
 /// </summary>
 /// <param name="html">The HTML.</param>
 /// <param name="items">The items.</param>
 /// <param name="headertemplete">The headertemplete.</param>
 /// <param name="itemtemplete">The itemtemplete.</param>
 public static void AccordionHtml(this HtmlHelper html, List<AccordionItem> items, Func<AccordionItem, string> headertemplete, Func<AccordionLeafItem, string> itemtemplete)
 {
     if (items != null)
     {
         StringBuilder buffer = new StringBuilder();
         HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(buffer));
         foreach (AccordionItem item in items)
         {
             writer.AddAttribute(HtmlTextWriterAttribute.Class, "accordionheadercontainer");
             writer.RenderBeginTag(HtmlTextWriterTag.Div);
             writer.Write(headertemplete(item));
             writer.RenderEndTag();
             writer.AddAttribute(HtmlTextWriterAttribute.Class, "accordionbody");
             writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
             writer.RenderBeginTag(HtmlTextWriterTag.Div);
             writer.RenderBeginTag(HtmlTextWriterTag.Ul);
             foreach (AccordionLeafItem leafitem in item.Children)
             {
                 writer.AddAttribute(HtmlTextWriterAttribute.Class, "accordionitemcontainer");
                 writer.RenderBeginTag(HtmlTextWriterTag.Li);
                 writer.Write(itemtemplete(leafitem));
                 writer.RenderEndTag();
             }
             writer.RenderEndTag();
             writer.RenderEndTag();
         }
         HttpContext.Current.Response.Write(buffer.ToString());
     }
 }
开发者ID:xiachanghao,项目名称:SmartBoxConsole,代码行数:36,代码来源:HtmlHelperExtension.cs

示例4: Render

        //- #Render -//
        /// <summary>
        /// Removes viewstate, event validation and the ASP.NET form element from the page
        /// </summary>
        /// <param name="originalWriter">The original writer.</param>
        protected override void Render(HtmlTextWriter originalWriter)
        {
            var stringWriter = new StringWriter(CultureInfo.CurrentCulture);
            var htmlTextWriter = new HtmlTextWriter(stringWriter);
            //+
            base.Render(htmlTextWriter);
            htmlTextWriter.Close();
            //+
            String data = stringWriter.GetStringBuilder().ToString();
            String pattern = @"<div>([\r\n\s]*)<input type=""hidden"" name=""__VIEWSTATE"" id=""__VIEWSTATE"" value=""(?<viewstate>[+/=a-z0-9]+)"" />([\r\n\s]*)</div>";
            data = Regex.Replace(data, pattern, String.Empty, RegexOptions.IgnoreCase);
            pattern = @"<div>([\r\n\s]*)<input type=""hidden"" name=""__EVENTVALIDATION"" id=""__EVENTVALIDATION"" value=""(?<eventvalidation>[+/=a-z0-9]+)"" />([\r\n\s]*)</div>";
            data = Regex.Replace(data, pattern, String.Empty, RegexOptions.IgnoreCase);
            pattern = @"<form name=""ctl([\d]+)"" method=""post"" action="""" id=""ctl([\d]+)"">([\r\n\s]*)";
            data = Regex.Replace(data, pattern, String.Empty, RegexOptions.IgnoreCase);
            if (!EnableState)
            {
                pattern = @"<form name=""ctl([\d]+)"" method=""post"">([\r\n\s]*)";
                data = Regex.Replace(data, pattern, String.Empty, RegexOptions.IgnoreCase);
            }
            pattern = @"([\r\n\s]*)</form>";
            String replacement = String.Empty;
            if (EnableState)
            {
                replacement = new StateArea().GetRenderData() + @"
</form>";
            }
            data = Regex.Replace(data, pattern, replacement, RegexOptions.IgnoreCase);
            //+
            originalWriter.Write(data);
        }
开发者ID:davidbetz,项目名称:nalarium.web,代码行数:36,代码来源:SimplePage.cs

示例5: btnPDF_Click

 protected void btnPDF_Click(object sender, ImageClickEventArgs e)
 {
     Response.ContentType = "application/pdf";
     Response.AddHeader("content-disposition", "attachment;filename=UserDetails.pdf");
     Response.Cache.SetCacheability(HttpCacheability.NoCache);
     var sw = new StringWriter();
     var hw = new HtmlTextWriter(sw);
     gvdetails.AllowPaging = false;
     gvdetails.DataBind();
     gvdetails.RenderControl(hw);
     gvdetails.HeaderRow.Style.Add("width", "15%");
     gvdetails.HeaderRow.Style.Add("font-size", "10px");
     gvdetails.Style.Add("text-decoration", "none");
     gvdetails.Style.Add("font-family", "Arial, Helvetica, sans-serif;");
     gvdetails.Style.Add("font-size", "8px");
     var sr = new StringReader(sw.ToString());
     var pdfDoc = new Document(PageSize.A2, 7f, 7f, 7f, 0f);
     var htmlparser = new HTMLWorker(pdfDoc);
     PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
     pdfDoc.Open();
     htmlparser.Parse(sr);
     pdfDoc.Close();
     Response.Write(pdfDoc);
     Response.End();
 }
开发者ID:haithemaraissia,项目名称:Advertise,代码行数:25,代码来源:Performance.aspx.cs

示例6: Render

 public void Render(
     HtmlTextWriter writer,
     TypeSignature signature,
     TypeRenderOption options)
 {
     Render(writer, signature, options, false);
 }
开发者ID:cgourlay,项目名称:website,代码行数:7,代码来源:TypeRenderer.cs

示例7: Render

 protected override void Render(HtmlTextWriter writer)
 {
     int num;
     int.TryParse(HttpContext.Current.Request.QueryString.Get("id"), out num);
     ActivityInfo activity = VshopBrowser.GetActivity(num);
     if (activity != null)
     {
         string format = "<div class=\"qb_mb10 qb_flex\"><input type=\"text\" class=\"mod_input flex_box\" style=\"height:35px;\" placeholder=\"您的{0}\" id=\"{1}\"></div>";
         StringBuilder builder = new StringBuilder();
         builder.AppendFormat("<input type=\"hidden\" id=\"id\" value=\"{0}\">", num);
         if (!string.IsNullOrEmpty(activity.Item1))
         {
             builder.AppendFormat(format, activity.Item1, "item1");
         }
         if (!string.IsNullOrEmpty(activity.Item2))
         {
             builder.AppendFormat(format, activity.Item2, "item2");
         }
         if (!string.IsNullOrEmpty(activity.Item3))
         {
             builder.AppendFormat(format, activity.Item3, "item3");
         }
         if (!string.IsNullOrEmpty(activity.Item4))
         {
             builder.AppendFormat(format, activity.Item4, "item4");
         }
         if (!string.IsNullOrEmpty(activity.Item5))
         {
             builder.AppendFormat(format, activity.Item5, "item5");
         }
         writer.Write(builder.ToString());
     }
 }
开发者ID:ZhangVic,项目名称:asp1110git,代码行数:33,代码来源:Common_ActivityCondition.cs

示例8: Render

        protected override void Render(HtmlTextWriter writer)
        {
            switch (((OrderStatus) this.PurchaseStatusCode))
            {
                case OrderStatus.WaitBuyerPay:
                    base.NavigateUrl = Globals.ApplicationPath + "/Admin/purchaseOrder/UnPaymentPurchaseOrderDetails.aspx?PurchaseOrderId=" + this.PurchaseOrderId;
                    break;

                case OrderStatus.BuyerAlreadyPaid:
                    base.NavigateUrl = Globals.ApplicationPath + "/Admin/purchaseOrder/UnShippingPurchaseOrderDetails.aspx?PurchaseOrderId=" + this.PurchaseOrderId;
                    break;

                case OrderStatus.SellerAlreadySent:
                    base.NavigateUrl = Globals.ApplicationPath + "/Admin/purchaseOrder/DeliveredPurchaseOrderDetails.aspx?PurchaseOrderId=" + this.PurchaseOrderId;
                    break;

                case OrderStatus.Closed:
                    base.NavigateUrl = Globals.ApplicationPath + "/Admin/purchaseOrder/ClosedPurchaseOrderDetails.aspx?PurchaseOrderId=" + this.PurchaseOrderId;
                    break;

                case OrderStatus.Finished:
                    base.NavigateUrl = Globals.ApplicationPath + "/Admin/purchaseOrder/FinishedPurchaseOrderDetails.aspx?PurchaseOrderId=" + this.PurchaseOrderId;
                    break;
            }
            base.Render(writer);
        }
开发者ID:davinx,项目名称:himedi,代码行数:26,代码来源:PurchaseOrderDetailsHyperLink.cs

示例9: AddAttributesToRender

 protected override void AddAttributesToRender(HtmlTextWriter writer)
 {
     string associatedControlID = this.AssociatedControlID;
     if (associatedControlID.Length != 0)
     {
         if (this.AssociatedControlInControlTree)
         {
             Control control = this.FindControl(associatedControlID);
             if (control == null)
             {
                 if (!base.DesignMode)
                 {
                     throw new HttpException(System.Web.SR.GetString("LabelForNotFound", new object[] { associatedControlID, this.ID }));
                 }
             }
             else
             {
                 writer.AddAttribute(HtmlTextWriterAttribute.For, control.ClientID);
             }
         }
         else
         {
             writer.AddAttribute(HtmlTextWriterAttribute.For, associatedControlID);
         }
     }
     base.AddAttributesToRender(writer);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:Label.cs

示例10: ExportToPDF

        private void ExportToPDF()
        {
            using (StringWriter sw = new StringWriter())
            {
                using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                {
                    //To Export all pages
                    this.gvExportToPdf.AllowPaging = false;
                    //this.BindGridView();

                    this.gvExportToPdf.RenderControl(hw);
                    StringReader sr = new StringReader(sw.ToString());
                    Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                    HTMLWorker htmlparser = new HTMLWorker(pdfDoc);

                    Response.ContentType = "application/pdf";
                    Response.AddHeader("content-disposition", "attachment;filename=DashboardReport.pdf");
                    Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
                    pdfDoc.Open();
                    htmlparser.Parse(sr);
                    pdfDoc.Close();
                    Response.Write(pdfDoc);
                    Response.End();
                }
            }
        }
开发者ID:raselahmmedgit,项目名称:kendoui-sample-javascript,代码行数:27,代码来源:ExportToPdf.aspx.cs

示例11: CreateSummary

 private string CreateSummary() {
     StringWriter stringWriter = new StringWriter();
     HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
     htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class,
         "table table-bordered");
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Table);
     htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, "success");
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write("Requests");
     htmlWriter.RenderEndTag();
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write(requestCount);
     htmlWriter.RenderEndTag();
     htmlWriter.RenderEndTag();
     htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, "success");
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write("Total Time");
     htmlWriter.RenderEndTag();
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write("{0:F5} seconds", totalTime);
     htmlWriter.RenderEndTag();
     htmlWriter.RenderEndTag();
     htmlWriter.RenderEndTag();
     return stringWriter.ToString();
 }
开发者ID:Geronimobile,项目名称:DotNetExamIntro,代码行数:27,代码来源:TotalTimeModule.cs

示例12: RenderControl

        /// <summary>
        /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        public override void RenderControl( HtmlTextWriter writer )
        {
            if ( this.Visible )
            {
                string alertType = NotificationBoxType.ToString().ToLower();

                bool showMessage = !string.IsNullOrWhiteSpace( Heading ) || !string.IsNullOrWhiteSpace( Title ) || !string.IsNullOrWhiteSpace( this.Text );

                if ( showMessage )
                {
                    writer.AddAttribute( "class", "alert alert-" + alertType );
                    writer.RenderBeginTag( HtmlTextWriterTag.Div );

                    if ( !string.IsNullOrWhiteSpace( Heading ) )
                    {
                        writer.RenderBeginTag( HtmlTextWriterTag.H4 );
                        writer.Write( Heading );
                        writer.RenderEndTag();
                    }

                    if ( !string.IsNullOrWhiteSpace( Title ) )
                    {
                        writer.RenderBeginTag( HtmlTextWriterTag.Strong );
                        writer.Write( Title + " ");
                        writer.RenderEndTag();
                    }

                    base.RenderControl( writer );

                    writer.RenderEndTag();
                }
            }
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:37,代码来源:NotificationBox.cs

示例13: GetEmployeesAccessMasterGrid

        public void GetEmployeesAccessMasterGrid()
        {
            Grid mastergrid = new Grid
                                  {
                                      DataSourceId = "Employees",
                                      ID = "test",
                                      Page = Testpage,
                                      ConnectionString = ConnectionAccessOleDb
                                  };
            Testpage.Controls.Add(mastergrid);

            Grid slavegrid = new Grid
                                 {
                                     DataSourceId = "Territories",
                                     ID = "test2",
                                     Page = Testpage,
                                     MasterGrid = "test",
                                     ConnectionString = ConnectionAccessOleDb
                                 };
            Testpage.Controls.Add(slavegrid);

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            mastergrid.RenderControl(gridwriter);

            sb = new StringBuilder();
            sw = new StringWriter(sb);
            gridwriter = new HtmlTextWriter(sw);
            slavegrid.RenderControl(gridwriter);

            Assert.Greater(mastergrid.MasterTable.Rows.Count, 1);
            Assert.IsTrue(mastergrid.MasterTable.GotSchema);
            Assert.IsFalse(slavegrid.MasterTable.GotSchema);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:35,代码来源:Relations.cs

示例14: ProcessRequest

        public new void ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, string operationName)
        {
            EndpointHost.Config.AssertFeatures(Feature.Metadata);

            var operations = EndpointHost.ServiceOperations;

            if (httpReq.QueryString["xsd"] != null)
            {
                var xsdNo = Convert.ToInt32(httpReq.QueryString["xsd"]);
                var schemaSet = XsdUtils.GetXmlSchemaSet(operations.AllOperations.Types);
                var schemas = schemaSet.Schemas();
                var i = 0;
                if (xsdNo >= schemas.Count)
                {
                    throw new ArgumentOutOfRangeException("xsd");
                }
                httpRes.ContentType = "text/xml";
                foreach (XmlSchema schema in schemaSet.Schemas())
                {
                    if (xsdNo != i++) continue;
                    schema.Write(httpRes.Output);
                    break;
                }
                return;
            }

            var writer = new HtmlTextWriter(httpRes.Output);
            httpRes.ContentType = "text/html";
            ProcessOperations(writer, httpReq);
            writer.Flush();
        }
开发者ID:nigthwatch,项目名称:ServiceStack,代码行数:31,代码来源:BaseSoapMetadataHandler.cs

示例15: RenderCurrencySign

        private void RenderCurrencySign(HtmlTextWriter writer)
        {
            var cs = GetCurrencySign();

            if (!string.IsNullOrEmpty(cs))
                writer.Write(cs + " ");
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:7,代码来源:Currency.cs


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