【问题标题】:Issues with text input control (Text area )in asp.net and HTML Decodingasp.net 和 HTML 解码中的文本输入控件(文本区域)问题
【发布时间】:2016-03-07 15:22:57
【问题描述】:

我正在尝试合并一个响应式 jquery 输入控件来输入博客,该控件将保存到数据库中,然后检索到 Web 表单页面。

我遇到了输入文本控件的问题,因为当我通过网站首页的转发器呈现它们时,通过它创建的条目会劫持我的博客滑块本身。

当我导出简单的纯文本时它工作正常,当我什至导出这个 HTML 编码文本时它也工作正常但是当我将 .ToSubstring() 函数添加到它开始起作用的 eval 方法时,我的滑块本身就崩溃了。冲突 ?

这是我的代码

<%#System.Web.HttpUtility.HtmlDecode(Eval("Content").ToString().Substring(0,180)) %>

这是 HTML 编码的文本

<div class="MsoNormal" style="text-align: justify;">Our last pilgrimage to <a href="http://www.sigandur.in/" target="_blank">Sri Chowdeshwari Temple</a> at Sigandhur (Karnataka) was in <a href="http://kartourism.blogspot.com/2009/01/sigandhur-tourism.html">2009</a>. It was time to revisit the temple and offer our prayers. We knew very well about the perils of visiting the temple on a holiday, yet we undertook the pilgrimage as we had a packed schedule.</div>

 

这是使用 .ToSubstring() 方法添加滑块时的中断方式

谁能帮我解决这个问题?建议我一个更好的文本输入控件,它不会与用户代码冲突。谢谢你

这也是我的滑块代码

<div class="col-md-6" style="height: 260px; background-color: #EEEEEE">
    <h3 style="text-align: center; font-weight: bold;">Blogging my Thoughts <span>
        <img style="height: 35px; width: 35px" src="images/home/pen.png" />
    </span></h3>

    <div id="carousel-example" class="carousel slide" data-ride="carousel">

        <div class="carousel-inner">
            <asp:Repeater ID="RepDetails" runat="server">
                <ItemTemplate>
                    <div class="item <%# (Container.ItemIndex == 0 ? "active" : "") %>">
                        <div class="testimonial-section">

                            <h3 runat="server" id="fh"><%#Eval("Heading") %></h3>
                            <p runat="server" id="fp">
                                <%#System.Web.HttpUtility.HtmlDecode(Eval("Content").ToString().Substring(0,180)) %>

                            </p>
                            <br />
                            <a href='<%#String.Format("{0}", Eval("Seo"))%>' style="font-weight: bold; font-size: 16px">Continue Reading </a>
                        </div>

                    </div>
                </ItemTemplate>
            </asp:Repeater>

            <ol class="carousel-indicators carousel-indicators-set">
                <li data-target="#carousel-example" data-slide-to="0" class="active"></li>
                <li data-target="#carousel-example" data-slide-to="1"></li>
                <li data-target="#carousel-example" data-slide-to="2"></li>
            </ol>

        </div>

    </div>

</div>

【问题讨论】:

    标签: jquery css asp.net twitter-bootstrap


    【解决方案1】:

    这是因为您正在制作.Substring(0,180),但编码文本超过180,它是463个字符, 所以&lt;div&gt; 标签是打开的并且没有关闭,因为结束标签&lt;/div&gt; 在 180 个字符之后


    我认为你必须显示所有编码的文本,或者你必须显示一些没有 html 标记的其他内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-08
      • 1970-01-01
      相关资源
      最近更新 更多