break the text into multilines

Hi all

i am getting the data from table from select command by using data source and i am displaying the data in gridview

in that i am showing name and email etc

here my requirement is i am unable to break the email text into two lines if i am stricting the width to 10% as the email text is a single word

How can i break it

With Regards

TIS
[396 byte] By [tis707] at [2007-11-20 9:19:49]
# 1 Re: break the text into multilines
I guess you can't break it because that is a single word. You could do some format thing before display though.
jasonli at 2007-11-9 11:34:10 >
# 2 Re: break the text into multilines
Can you provider some examples as :
your current text and expected result.
N0Em0t10n at 2007-11-9 11:35:10 >
# 3 Re: break the text into multilines
yes,

if the email text is johnsmithvcprogrammer@dev-archive.com

its better for me to show by breaking it into more lines from 10 th character

Thanks a lot

With Regards

TIS
tis707 at 2007-11-9 11:36:09 >
# 4 Re: break the text into multilines
Hi ra prabhat this is bhaskar.

If you are using either DataGrid or GridView place a lable in item template
and write the code in Item Data Bound Event.

Here is the Code.. This code is in asp.net just convert this to C#.net..

Protected Sub dgSpecialOffers_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgSpecialOffers.ItemDataBound
Try
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim lblDescription As New Label
Dim Description As String
lblDescription = e.Item.FindControl("lblDescription")
lblDescription.Text = DataBinder.Eval(e.Item.DataItem, "Description")
If lblDescription.Text.Length > 60 And lblDescription.Text.Length < 120 Then
Description = lblDescription.Text.Substring(0, 60)
Description += "<br>"
Description += lblDescription.Text.Substring(60)
lblDescription.Text = Description
ElseIf lblDescription.Text.Length > 120 And lblDescription.Text.Length < 180 Then
Description = lblDescription.Text.Substring(0, 60)
Description += "<br>"
Description += lblDescription.Text.Substring(60, 120)
Description += "<br>"
Description += lblDescription.Text.Substring(120)
lblDescription.Text = Description
ElseIf lblDescription.Text.Length > 180 And lblDescription.Text.Length < 240 Then
Description = lblDescription.Text.Substring(0, 60)
Description += "<br>"
Description += lblDescription.Text.Substring(60, 120)
Description += "<br>"
Description += lblDescription.Text.Substring(120, 180)
Description += "<br>"
Description += lblDescription.Text.Substring(180)
lblDescription.Text = Description
Else
lblDescription.Text = DataBinder.Eval(e.Item.DataItem, "Description")
End If
End If
Catch ex As Exception

End Try
End Sub
baachi_baachi at 2007-11-9 11:37:14 >
# 5 Re: break the text into multilines
Hi ra prabhat this is bhaskar.

If you are using either DataGrid or GridView place a lable in item template
and write the code in Item Data Bound Event.

Here is the Code.. Hi !
Welcome to dev-archive forum and thx for your help here. But Please read our posting rules first and use codetags as we all use for getting better readable code.
:wave:
JonnyPoet at 2007-11-9 11:38:14 >