I need to put line breaks in the product description. I'm using XML for now. My product descriptions use bullet points, so I need line breaks. I guess this would also apply to multi-paragraph descriptions. For Example, I would like to see
Product Name
Description
- Feature 1
- Feature 2
What I get now is Description -Feature1 -Feature2.
I have tried \n\r in the description, but they get displayed litterally (Description\n\r-Feature1\n\r-Feature2). I have also tried <br />, but that gives me a configureation error.
Is this something that must be done in VB? If so, how. I need the line breaks, I hope someone can help.
XMLsmall businesssmall businessmallbusiness databaseSmall Business Starter Kit
Thank you for replying. However, I'm not sure how to properly answer your question.
The data string is in an xml file which is read by a .aspx file. The item Description is read by an EVAL command within asp:DetailsView. Code is below.
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<a
href="Items.aspx">Return to All Items</a><img
src="images/arrow.gif"
alt=""
/>
</div>
<!-- END MAIN COLUMN -->
I'm wondering if something different than EVAL should be used. I'm wondering how to change the text from green back to black.
# Eval("Description")%> to
<%# Eval("Description").ToString().Replace(Environment.NewLine,"<br
/>") %>
Thanks for pointing me in the direction of Environment.NewLine. I found a link that explains this fully.
casajr
0 Points
4 Posts
Need to Put Line Breaks in the Product Description.
Jun 09, 2009 10:18 PM|LINK
I need to put line breaks in the product description. I'm using XML for now. My product descriptions use bullet points, so I need line breaks. I guess this would also apply to multi-paragraph descriptions. For Example, I would like to see
Product Name
Description
- Feature 1
- Feature 2
What I get now is Description -Feature1 -Feature2.
I have tried \n\r in the description, but they get displayed litterally (Description\n\r-Feature1\n\r-Feature2). I have also tried <br />, but that gives me a configureation error.
Is this something that must be done in VB? If so, how. I need the line breaks, I hope someone can help.
XML small business small busines smallbusiness database Small Business Starter Kit
Nowman
Member
370 Points
135 Posts
Re: Need to Put Line Breaks in the Product Description.
Jun 09, 2009 10:30 PM|LINK
what is the container that you are pushing this test to? a label?
try Environment.NewLine, <br />, <br>, \v, (char)11, or \r\n and see if any work.
if not let me know what the configuration error is.
casajr
0 Points
4 Posts
Re: Need to Put Line Breaks in the Product Description.
Jun 10, 2009 02:56 AM|LINK
Thank you for replying. However, I'm not sure how to properly answer your question.
The data string is in an xml file which is read by a .aspx file. The item Description is read by an EVAL command within asp:DetailsView. Code is below.
<
div id="content-main-three-column"> <asp:ObjectDataSource ID="ObjectDataSourceItem" runat="server" SelectMethod="GetItem" TypeName="Catalog"> <SelectParameters> <asp:QueryStringParameter Name="itemId" QueryStringField="itemId" Type="string" DefaultValue="" /> </SelectParameters> </asp:ObjectDataSource> <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="false" AllowPaging="false" BorderWidth="0" BorderColor="white" DataSourceID="ObjectDataSourceItem"> <Fields> <asp:TemplateField> <ItemTemplate> <h1> <%#Eval("Title")%> </h1> <br /> <asp:Image ID="Image1" CssClass="photo-border" runat="server" ImageUrl='<%# "images/" + Eval("ImageUrl") %>' AlternateText='<%#Eval("ImageAltText")%>' />
<br /> <h2> <%# Eval("Price","{0:C}")%> </h2> <br /> <%# Eval("Description")%> <br />
<br />In Stock:
<%# IIf(Eval("InStock")= true, "Yes", "No") %> <hr /> <br /> <asp:Image ID="Image2" CssClass="photo-border" runat="server" ImageUrl='<%# "images/" + Eval("ColorTableUrl") %>' AlternateText='<%#Eval("ImageAltText")%>' />
</ItemTemplate> </asp:TemplateField> </Fields> </asp:DetailsView> <a href="Items.aspx">Return to All Items</a><img src="images/arrow.gif" alt="" /> </div> <!-- END MAIN COLUMN -->I'm wondering if something different than EVAL should be used. I'm wondering how to change the text from green back to black.
casajr
0 Points
4 Posts
Re: Need to Put Line Breaks in the Product Description.
Jun 10, 2009 03:28 AM|LINK
OK, I fixed it. The solution is to change the
<%
# Eval("Description")%> to <%# Eval("Description").ToString().Replace(Environment.NewLine,"<br />") %> Thanks for pointing me in the direction of Environment.NewLine. I found a link that explains this fully.http://www.mikesdotnetting.com/Article.aspx?ArticleID=20