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


C# HtmlString.ToString方法代码示例

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


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

示例1: agregarHistoria

 public ActionResult agregarHistoria(int id)
 {
     var Equipo = db.equipo.FirstOrDefault(e => e.idEquipo.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Equipo.historia));
     Equipo.historia = h.ToString();
     return View(Equipo);
 }
开发者ID:ruisu08,项目名称:Protos,代码行数:7,代码来源:EquipoController.cs

示例2: agregarMultimedia

 public ActionResult agregarMultimedia(int id)
 {
     var Anuncio = db.anuncio.FirstOrDefault(e => e.idAnuncio.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Anuncio.fuenteGrafica));
     Anuncio.fuenteGrafica = h.ToString();
     return View(Anuncio);
 }
开发者ID:ruisu08,项目名称:Protos,代码行数:7,代码来源:AnuncioController.cs

示例3: agregarContenido

 public ActionResult agregarContenido(int id)
 {
     var Pagina = db.pagina_informativa.FirstOrDefault(e => e.idPagina_Informativa.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Pagina.contenido));
     Pagina.contenido = h.ToString();
     return View(Pagina);
 }
开发者ID:ruisu08,项目名称:Protos,代码行数:7,代码来源:PaginaInformativaController.cs

示例4: agregarImagenPrincipal

 public ActionResult agregarImagenPrincipal(int id)
 {
     var Noticia = db.noticia.FirstOrDefault(e => e.idNoticia.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Noticia.contenido));
     Noticia.imagenPrincipal = h.ToString();
     return View(Noticia);
 }
开发者ID:ruisu08,项目名称:Protos,代码行数:7,代码来源:NoticiaController.cs

示例5: Icon

        /// <summary>
        /// Renders an icon image using the specified metadata.
        /// </summary>
        /// <param name="title">The title to use. If NULL, defaults to the value stored on the icon.</param>
        /// <param name="alt">The alt text. If NULL, defaults to the value stored on the icon.</param>
        /// <param name="url">A URL to link to. If not NULL, a link tag to this value is wrapped around the icon.</param>
        /// <param name="onclick">The onclick handler to render.</param>
        /// <param name="cssClass">The CSS class to assign to the image.</param>
        /// <param name="attributes">A dictionary of additional html attributes to render.</param>
        public static IHtmlString Icon(this HtmlHelper html,
			IIconMetaData icon,
			string title = null,
			string alt = null,
			string url = null,
			string onclick = null,
			string cssClass = null,
			object attributes = null)
        {
            var image = new TagBuilder("img");
            image.Attributes.Add("alt", alt ?? icon.AltText);
            image.Attributes.Add("title", title ?? icon.Title);

            SetOnclickHandler(onclick, image);
            SetCssClass(cssClass, image);
            SetImageSrc(html, icon, image);
            MergeHtmlAttributes(attributes, image);

            var imageTagHtml = new HtmlString(
                image.ToString(TagRenderMode.SelfClosing)
            );

            if (url.IsNotNullOrEmpty()) {
                imageTagHtml = new HtmlString(
                    String.Format("<a href=\"{0}\">{1}</a>", url, imageTagHtml.ToString())
                );
            }

            return imageTagHtml;
        }
开发者ID:spetryjohnson,项目名称:IconHelper,代码行数:39,代码来源:IconExtensions.cs

示例6: GetPageHtml

    public static string GetPageHtml(int total, int pageSize, int pageIndex)
    {
        int allpage = 0;//总页数
        int next = 0;//下一页
        int prev = 0;//上一页
        string pagestr = "";
        int startCount = 0;//开始页
        int endCount = 0;//结束页
        if (pageIndex < 1) { pageIndex = 1; }
        //计算总页数
        if (pageSize != 0)
        {
            allpage = (total / pageSize);
            allpage = ((total % pageSize) != 0 ? allpage + 1 : allpage);
            allpage = (allpage == 0 ? 1 : allpage);
        }
        next = pageIndex + 1;
        prev = pageIndex - 1;
        startCount = (pageIndex + 5) > allpage ? allpage - 9 : pageIndex - 4;//中间页起始序号
        endCount = pageIndex < 5 ? 10 : pageIndex + 5;
        if (startCount < 1) { startCount = 1; }
        if (allpage < endCount) { endCount = allpage; }
        pagestr += pageIndex > 1 ? "<a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3,1)\">首页</a><a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + prev + ")\">上一页</a>" : "";
        for (int i = startCount; i <= endCount; i++)
        {
            pagestr += pageIndex == i ? "<a id=\"current\">" + i + "</a>" : "<a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + i + ")\">" + i + "</a>";
        }
        pagestr += pageIndex != allpage ? "<a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + next + ")\">下一页</a><a class=\"paginate_button\" href=\"javascript:$$.listSubmit(3," + allpage + ")\">尾页</a>" : "";

        var selectHtml = "<select onchange=\"$$.listSubmit(2,this)\"><option " + (pageSize == 5 ? "selected=\"selected\"" : "") + " >5</option><option " + (pageSize == 10 ? "selected=\"selected\"" : "") + ">10</option><option " + (pageSize == 30 ? "selected=\"selected\"" : "") + ">30</option><option " + (pageSize == 50 ? "selected=\"selected\"" : "") + ">50</option><option " + (pageSize == 100 ? "selected=\"selected\"" : "") + ">100</option></select>";
        HtmlString result = new HtmlString("<div class=\"M_pagination\"><span>共" + total + "条记录" + selectHtml + "</span>" + pagestr + "</div>");
        return result.ToString();
    }
开发者ID:cameo29,项目名称:JQTable,代码行数:33,代码来源:Ajax.aspx.cs

示例7: agregarMultimedia

 public ActionResult agregarMultimedia(int id)
 {
     var Patrocinador = db.patrocinador.FirstOrDefault(e => e.idPatrocinador.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Patrocinador.fuenteGrafica));
     Patrocinador.fuenteGrafica = h.ToString();
     return View(Patrocinador);
 }
开发者ID:ruisu08,项目名称:Protos,代码行数:7,代码来源:PatrocinadorController.cs

示例8: agregarHistoria

 public ActionResult agregarHistoria(int id)
 {
     var Jugadora = db.jugadora.FirstOrDefault(e => e.idJugadora.Equals(id));
     var h = new HtmlString(HttpUtility.HtmlDecode(Jugadora.historia));
     Jugadora.historia = h.ToString();
     return View(Jugadora);
 }
开发者ID:ruisu08,项目名称:Protos,代码行数:7,代码来源:JugadoraController.cs

示例9: LoadTemplate

        private  string LoadTemplate(string templatePath)
        {
            HtmlString html;
            using (var sr = new StreamReader("Resources/AlertNotificationTemplate.html"))
            {
                var file = sr.ReadToEnd();
                html = new HtmlString(file);
            }
           

            string rawEmail = html.ToString();
            return rawEmail;
        }
开发者ID:sogeti,项目名称:Site-provisioning,代码行数:13,代码来源:NotificationMail.cs

示例10: ProcessChoosenItems

        public HtmlString ProcessChoosenItems(string parametersId, string distMatrixId, string flowMatrixId)
        {
            Parameters parameters = _parametersRepository.Get(Convert.ToInt32(parametersId));
            DistMatrix distMatrix = _distMatricesRepository.Get(Convert.ToInt32(distMatrixId));
            FlowMatrix flowMatrix = _flowMatricesRepository.Get(Convert.ToInt32(flowMatrixId));

            Stream paramStream = new MemoryStream(Encoding.UTF8.GetBytes(parameters.StringView));
            string graph = string.Format("{0}\n{1}", distMatrix.MatrixView, flowMatrix.MatrixView);
            Stream graphStream = new MemoryStream(Encoding.UTF8.GetBytes(graph));

            _qapAntAlgorithm = _standartAlgorithmBuilder.GetAlgorithm<QapGraph>(paramStream);
            QapGraph qapGraph = new QapGraph().Load(graphStream, _qapAntAlgorithm.NAnts);
            _qapAntAlgorithm.Calculate(qapGraph);

            HtmlString result = new HtmlString(_qapAntAlgorithm.Result);
            int pathCost = _qapAntAlgorithm.BestAnt.PathCost;

            ResultInfo resultInfo = new ResultInfo
            {
                ParametersId = parameters.Id,
                DistMatrixId = distMatrix.Id,
                FlowMatrixId = flowMatrix.Id,
                Result = result.ToString(),
                PathCost = pathCost
            };

            _resultsInfoRepository.Add(resultInfo);
            return result;
        }
开发者ID:LexaGal,项目名称:MvcAntsWeb,代码行数:29,代码来源:HomeController.cs

示例11: GridView1_RowDataBound

    /// <summary>
    /// Creates a HTML Select Tag with options from 0 to the amount of each Product of the row
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string cssclass = "id" + Convert.ToInt16(e.Row.Cells[2].Text);
            HtmlString select = new HtmlString("<select class='span2 quantity "+ cssclass +"' name='Cantidad'>");
            HtmlString selectend = new HtmlString("</select>");

            GridViewRow gvr = (GridViewRow)e.Row.Cells[1].NamingContainer;

            string options = "";
            for (int i = 0; i <= Convert.ToInt16(e.Row.Cells[5].Text); i++)
            {
                options += "<option value='"+i.ToString()+"'>"+i.ToString()+"</option>";
            }

            gvr.Cells[1].Text = select.ToString() + options + selectend.ToString();
        }
    }
开发者ID:efigarolam,项目名称:Snackthat,代码行数:24,代码来源:assignproducts.aspx.cs

示例12: ToAttributesDictionary

 private static Dictionary<string, string> ToAttributesDictionary(HtmlString htmlString)
 {
   return htmlString.ToString().Split(' ').Select(x => x.Split('=')).ToDictionary(x => x[0], val => val.Length == 1 ? "" : val[1].Trim('\'', '"'));
 }
开发者ID:robearlam,项目名称:Habitat,代码行数:4,代码来源:MediaSelectorElementsRepositoryTests.cs


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