Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
this is my code below.

when i write:

"hello world this
this is a test article".

I expect that what i write should display in that format.but what happen is that in display txtArticles it display continous like this.

"hello world this is a test article".



<pre lang="xml">&lt;div style=&quot;margin-left:200px; width: 756px;&quot;&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;asp:Label ID=&quot;lblNewsFeed&quot; runat=&quot;server&quot; Text=&quot;News Feed:&quot; Font-Bold=&quot;True&quot;
Font-Size=&quot;Larger&quot; ForeColor=&quot;White&quot; style=&quot;font-size: 35pt&quot; Width=&quot;240px&quot;
Font-Italic=&quot;True&quot;&gt;&lt;/asp:Label&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;asp:Image ID=&quot;imgNewsFeed&quot; runat=&quot;server&quot; Height=&quot;102px&quot; Width=&quot;116px&quot; /&gt; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;asp:FileUpload ID=&quot;FileUploadNewsFeed&quot; runat=&quot;server&quot; ForeColor=&quot;White&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;asp:Label ID=&quot;lblTitle&quot; runat=&quot;server&quot; Text=&quot;Title:&quot; Font-Bold=&quot;True&quot;
Font-Italic=&quot;False&quot; ForeColor=&quot;White&quot; style=&quot;font-size: 15pt&quot;&gt;&lt;/asp:Label&gt; &lt;br /&gt;
&lt;asp:TextBox ID=&quot;txtTitle&quot; runat=&quot;server&quot; Width=&quot;570px&quot;&gt;&lt;/asp:TextBox&gt;
&lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator1&quot; runat=&quot;server&quot; ErrorMessage=&quot;Please Write the Title!&quot; Font-Bold=&quot;True&quot; Font-Size=&quot;15pt&quot; ForeColor=&quot;#FFFF99&quot; style=&quot;font-size: 13pt&quot; ControlToValidate=&quot;txtTitle&quot; &gt;&lt;/asp:RequiredFieldValidator&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;asp:Label ID=&quot;lblArticles&quot; runat=&quot;server&quot; Text=&quot;Articles:&quot; Font-Bold=&quot;True&quot;
ForeColor=&quot;White&quot; style=&quot;font-size: 15pt&quot;&gt;&lt;/asp:Label&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;asp:Label ID=&quot;lbl_Save&quot; runat=&quot;server&quot; Font-Bold=&quot;True&quot; Font-Size=&quot;15pt&quot; ForeColor=&quot;#FFFF99&quot; &gt;&lt;/asp:Label&gt;
&lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator2&quot; runat=&quot;server&quot; ErrorMessage=&quot;Please Write the Article!&quot; Font-Bold=&quot;True&quot; Font-Size=&quot;15pt&quot; ForeColor=&quot;#FFFF99&quot; style=&quot;font-size: 13pt&quot; ControlToValidate=&quot;txtArticles&quot; &gt;&lt;/asp:RequiredFieldValidator&gt;
&lt;br /&gt;
&lt;asp:TextBox ID=&quot;txtArticles&quot; runat=&quot;server&quot; TextMode=&quot;MultiLine&quot; Wrap=&quot;true&quot;
Height=&quot;350px&quot; Width=&quot;570px&quot; CssClass=&quot;NoresizeTextBox&quot; &gt;&lt;/asp:TextBox&gt; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;asp:Button ID=&quot;btnClear&quot; runat=&quot;server&quot; Text=&quot;Clear&quot;
BackColor=&quot;#669999&quot; BorderColor=&quot;#009999&quot; Font-Bold=&quot;True&quot; Font-Italic=&quot;False&quot;
ForeColor=&quot;White&quot; OnClick=&quot;Clear_Click&quot; CausesValidation=&quot;False&quot; /&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;asp:Button ID=&quot;btnPost&quot; runat=&quot;server&quot; Text=&quot;Post Article&quot;
BackColor=&quot;#669999&quot; BorderColor=&quot;#009999&quot; Font-Bold=&quot;True&quot; Font-Italic=&quot;False&quot;
ForeColor=&quot;White&quot; OnClick=&quot;ArticlePost_Click&quot;/&gt;

&lt;/div&gt;</pre>


XML
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
                        <HeaderTemplate >
                            <table style="border-left-color:#75A4A4; border-left-style: solid; border-left-width: 2.5px;  border-top-style: solid; border-top-width: 2.5px; border-top-color:#75A4A4;" width="570" >
                        </HeaderTemplate>

                        <ItemTemplate>
                        <tr style="border-right-color:#669999">
                            <td>
                            <asp:Label ID="lblDate" runat="server" style="border-bottom-color :#719F9F; border-bottom-style: solid; border-bottom-width: 2.5px;"  Font-Size="11" Font-Bold="true" ForeColor="white" TextMode="MultiLine" Rows="0" Enabled="False" ReadOnly="True" BackColor="#669999" Wrap="True" Height="18px" Width="570px" BorderWidth="0px"  Text='<%#Eval("Date") %>' /> <br />
                            <asp:Label ID="lblTime" runat="server" style="border-bottom-color :#719F9F; border-bottom-style: solid; border-bottom-width: 2.5px;"  Font-Size="11" Font-Bold="true" ForeColor="white" TextMode="MultiLine" Rows="0" Enabled="False" ReadOnly="True" BackColor="#669999" Wrap="True" Height="18px" Width="570px" BorderWidth="0px"  Text='<%#Eval("Time") %>'/> <br /> <br /> <br />
                            <asp:TextBox ID="txtTitle" runat="server" Font-Names="Times New Roman" Font-Size="25px" ForeColor="white" Font-Bold="true" Rows="0" TextMode="MultiLine" Enabled="False" ReadOnly="True" BackColor="#669999" Wrap="True" Height="70px" Width="570px" BorderWidth="0px" style="text-align:center" CssClass="NoresizeTextBox" Text='<%#Eval("Title") %>'/> <br />
                            <asp:ImageButton ID="ImageButton1" runat="server" BackColor="#669999" ImageUrl='<%#Eval("ImageName", "~/NewsFeedImages/{0}") %>' Height="150px" Width="150px" style="margin-left:210px; cursor:pointer"  OnClientClick="return LoadDiv(this.src);" Title="View Image"  />
                            </td>

                        </tr>

                        <tr style="border-right-color:#669999;" >
                            <td class=" comment more"  <asp:TextBox ID="txtArticle" runat="server" style="text-align:left;" ForeColor="white" Font-Size="13"  Wrap="true" TextMode="MultiLine" Enabled="true" ReadOnly="True" BackColor="#669999" Width="570px" Height="100px" BorderWidth="0px"  CssClass="NoresizeTextBox"  Text='<%#DataBinder.Eval(Container.DataItem,"Articles").ToString() %>'></asp:TextBox>
                            </td>
                        </tr>

                        <tr>
                            <td style="border-bottom-style: solid; border-bottom-width:2px; border-bottom-color: #75A4A4;">
                            <br />
                            </td>
                        </tr>
                        </ItemTemplate>

                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                        ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString25 %>"
                        SelectCommand="SELECT [Title], [Articles], [Date], [Time], [ImageName] FROM [NewsFeedTbl] ORDER BY [id] DESC">
                    </asp:SqlDataSource>
Posted
Updated 26-May-13 6:33am
v3
Comments
Hi, brighteyes24379,

I tried to edit the code, but it is not getting formatted.

Please post the code again and remove this code.
brighteyes24 26-May-13 12:29pm    
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<HeaderTemplate >
<table style="border-left-color:#75A4A4; border-left-style: solid; border-left-width: 2.5px; border-top-style: solid; border-top-width: 2.5px; border-top-color:#75A4A4;" width="570" >
</HeaderTemplate>

<itemtemplate>
<tr style="border-right-color:#669999">
<td>
<asp:Label ID="lblDate" runat="server" style="border-bottom-color :#719F9F; border-bottom-style: solid; border-bottom-width: 2.5px;" Font-Size="11" Font-Bold="true" ForeColor="white" TextMode="MultiLine" Rows="0" Enabled="False" ReadOnly="True" BackColor="#669999" Wrap="True" Height="18px" Width="570px" BorderWidth="0px" Text='<%#Eval("Date") %>' /> <br />
<asp:Label ID="lblTime" runat="server" style="border-bottom-color :#719F9F; border-bottom-style: solid; border-bottom-width: 2.5px;" Font-Size="11" Font-Bold="true" ForeColor="white" TextMode="MultiLine" Rows="0" Enabled="False" ReadOnly="True" BackColor="#669999" Wrap="True" Height="18px" Width="570px" BorderWidth="0px" Text='<%#Eval("Time") %>'/> <br /> <br /> <br />
<asp:TextBox ID="txtTitle" runat="server" Font-Names="Times New Roman" Font-Size="25px" ForeColor="white" Font-Bold="true" Rows="0" TextMode="MultiLine" Enabled="False" ReadOnly="True" BackColor="#669999" Wrap="True" Height="70px" Width="570px" BorderWidth="0px" style="text-align:center" CssClass="NoresizeTextBox" Text='<%#Eval("Title") %>'/> <br />
<asp:ImageButton ID="ImageButton1" runat="server" BackColor="#669999" ImageUrl='<%#Eval("ImageName", "~/NewsFeedImages/{0}") %>' Height="150px" Width="150px" style="margin-left:210px; cursor:pointer" OnClientClick="return LoadDiv(this.src);" Title="View Image" />
</td>

</tr>

<tr style="border-right-color:#669999;" >
<td class=" comment more" <asp:TextBox ID="txtArticle" runat="server" style="text-align:left;" ForeColor="white" Font-Size="13" Wrap="true" TextMode="MultiLine" Enabled="true" ReadOnly="True" BackColor="#669999" Width="570px" Height="100px" BorderWidth="0px" CssClass="NoresizeTextBox" Text='<%#DataBinder.Eval(Container.DataItem,"Articles").ToString() %>'>
</td>
</tr>

<tr>
<td style="border-bottom-style: solid; border-bottom-width:2px; border-bottom-color: #75A4A4;">
<br />
</td>
</tr>


<footertemplate>
</table>


<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString25 %>"
SelectCommand="SELECT [Title], [Articles], [Date], [Time], [ImageName] FROM [NewsFeedTbl] ORDER BY [id] DESC">



<div style="margin-left:200px; width: 756px;">
<br />
                                       
<asp:Label ID="lblNewsFeed" runat="server"
Thanks7872 26-May-13 12:26pm    
And how you expect that any one over here will go through your above code?
brighteyes24 26-May-13 12:30pm    
how to remove the above code?

1 solution

In HTML, your end-of-line characters are insignificant (give the same effect as a single blank space character). To have the effect of end of line, use <br/>. And the garbage text at the end of your post is full of HTML character entities, which you also must know. You cannot do ASP.NET development without understanding of HTML (and a lot more).

—SA
 
Share this answer
 
Comments
Maciej Los 26-May-13 13:43pm    
+5
Sergey Alexandrovich Kryukov 26-May-13 14:01pm    
Thank you, Maciej.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900