Reputation: 103
I am trying to incorporate a responsive jquery input control for inputting blogs, which will be saved to database, from then retrieved to web form page.
I am facing issues with the input text control as entries made through it are hijacking my blog slider itself when I render them through repeater in the front page of my website.
When I derive simple plain textx it works fine, when I even derive this HTML encoded text also it works fine but the moment I add .ToSubstring()
function to the eval method it starts acting up, breaks down my slider itself. conflict ?
Here is my code
<%#System.Web.HttpUtility.HtmlDecode(Eval("Content").ToString().Substring(0,180)) %>
Here is the HTML Encoded text
<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>
This is how slider breaks when added with .ToSubstring() method
Can anyone help me in solving this problem ? or suggest me a better text input control, which doesn't conflict with users code. Thank you
Here is my slider code too
<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>
Upvotes: 0
Views: 60
Reputation: 69
this is because you are making .Substring(0,180)
but the encoded text is more than 180, it is 463 character,
so the <div>
tag is opened and didn't closed because the closing tag </div>
is after the 180 characters
i think that you have to display all encoded text or you have to display some other content without html tags.
Upvotes: 0