Reputation: 173
Two ASP.NET Web form pages:
Page1:
Type: Normal asp.net page, no containers or database binding controls
Rendered as: Content Content
Source (as shown in browser tool): <p>Content Content</p>
(Life is happy)
Page2:
Type: Database content, using DetailsView Control
Rendered as: Content Content
Source (as shown in browser tool): <p>Content Content</p>
I'm gonna be mad why does that happen! I want the
to be a blank space!
Is that DetailsView charm or what!!
Appendix: Page2 markup
<ItemTemplate>
<%--Title--%>
<asp:Label ID="lblTitle" runat="server" Text='<%# Eval("title") %>'></asp:Label>
<br />
<%--Date--%>
<asp:Label ID="lblDate" runat="server" Text='<%# Eval("date") %>'></asp:Label>
<br />
<%--Content--%>
<p>
<asp:Literal ID="lblContent" runat="server" Text='<%# Bind("content") %>' />
</p>
</ItemTemplate>
Note that I tried the asp:Label
and asp:Literal
Upvotes: 0
Views: 1177
Reputation: 1641
Not sure why you would need two-way databinding on a label, so I would probably go back to using something like the following:
<%--Content--%>
<p>
<asp:Literal ID="lblContent" runat="server" Text='<%# System.Web.HttpUtility.HtmlEncode((string)Eval("content")) %>' />
</p>
Upvotes: 1