Hello you all,

I have used label in repeater to display news content.see the code below.

<asp:Label ID="lblNewsContent" Width="1000px" Height="500px" runat="server" Text='<%#Eval("News_Content")%>' ReadOnly="true" BorderStyle="None" BorderColor="#EFF3FB" BackColor="#EFF3FB" TextMode="MultiLine"></asp:Label >

Now problem is that how can i give new line in label after certain amount of characters?means i have say 500 characters record i want break line or give new line after 50 characters.how can i achieve this?i m fetching news content from DB.

Give me some guidence.
Thank you all.

Recommended Answers

Hello you all,

I have used label in repeater to display news content.see the code below.

<asp:Label ID="lblNewsContent" Width="1000px" Height="500px" runat="server" Text='<%#Eval("News_Content")%>' ReadOnly="true" BorderStyle="None" BorderColor="#EFF3FB" BackColor="#EFF3FB" TextMode="MultiLine"></asp:Label >

Now problem is that how can i give new line in label after certain amount of characters?means i have say 500 characters …

Jump to Post

oh sorry first i have used textbox but later used label so forgot to remove textmode.but my question is same?

<asp:Label ID="lblNewsContent" Width="1000px" Height="500px" runat="server" Text='<%#Eval("News_Content")%>' ReadOnly="true" BorderStyle="None" BorderColor="#EFF3FB" BackColor="#EFF3FB" >

please reply me.

no dude- you can't do such thing with Label. Instead i say use Text Box and …

Jump to Post

All 6 Replies

Hello you all,

I have used label in repeater to display news content.see the code below.

<asp:Label ID="lblNewsContent" Width="1000px" Height="500px" runat="server" Text='<%#Eval("News_Content")%>' ReadOnly="true" BorderStyle="None" BorderColor="#EFF3FB" BackColor="#EFF3FB" TextMode="MultiLine"></asp:Label >

Now problem is that how can i give new line in label after certain amount of characters?means i have say 500 characters record i want break line or give new line after 50 characters.how can i achieve this?i m fetching news content from DB.

Give me some guidence.
Thank you all.

hey are you sure Label has TextMode property ? I believe Lable doesn't have Multiple line functionality.
Instead you can use Text Box set it's Wrap and TextMode property and it will work for you.

commented: pl reply me soon +1

oh sorry first i have used textbox but later used label so forgot to remove textmode.but my question is same?

<asp:Label ID="lblNewsContent" Width="1000px" Height="500px" runat="server" Text='<%#Eval("News_Content")%>' ReadOnly="true" BorderStyle="None" BorderColor="#EFF3FB" BackColor="#EFF3FB" >

please reply me.

oh sorry first i have used textbox but later used label so forgot to remove textmode.but my question is same?

<asp:Label ID="lblNewsContent" Width="1000px" Height="500px" runat="server" Text='<%#Eval("News_Content")%>' ReadOnly="true" BorderStyle="None" BorderColor="#EFF3FB" BackColor="#EFF3FB" >

please reply me.

no dude- you can't do such thing with Label. Instead i say use Text Box and with the help of style set Text Box such that it will look like label. :-)

i have used textbox with textmode =multiline earlier but i got scroll at right hand side which is not good looking as i have to only show the data.
ok if i use textbox according to you then how can i achieve solution for the same problem without scrolling in textbox?

pl reply

i have used textbox with textmode =multiline earlier but i got scroll at right hand side which is not good looking as i have to only show the data.
ok if i use textbox according to you then how can i achieve solution for the same problem without scrolling in textbox?

pl reply

Sorry for late replay...
you need to set either overflow:hidden; or overflow:auto; in style and then use this style in your text box.

it will work...

hi rohand,

i had applied ur css code and working properly, thanks dude.

now i want to give new line after fixed amount of characters(say after every 100characters) in that textbox as i had told u that i m displaying news content n large amount.

pl guide me for that.thanks waiting for ur reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.