2016-03-07 25 views
0

我想要合并一个响应式jQuery输入控件来输入博客,这些博客将被保存到数据库,然后从Web窗体页面中检索。在asp.net和HTML解码中的文本输入控件(文本区域)的问题

我面临输入文本控制的问题,因为通过它进行的输入会在我的网站首页通过中继器呈现它们时劫持我的博客滑块本身。

当我得到简单的纯textx它工作正常,当我甚至得到这个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()方法 添加时如何滑块断裂Slider

任何人都可以帮助我解决这个问题吗?建议我一个更好的文本输入控件,它不会与用户代码冲突。谢谢

这里是我的滑代码太

<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> 

回答

0

这是因为你正在.Substring(0,180)但编码文本超过180,这是463字符, 所以<div>标签被打开,没”牛逼关闭,因为关闭标签</div>是180个字符


我认为你必须要显示所有编码的文本,或者您有不显示HTML标签其他一些内容之后。