Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

line feeds in Gridview cells? vbcrlf ? new line?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wildman@noclient.net - 06 Mar 2008 19:53 GMT
Is there any way for gridview cells to observe vbcrlf in the data?

I attempted to do this, but it does not seem to work.

       Dim dgItem As GridViewRow
       For Each dgItem In gridCollaborator.Rows
           dgItem.Cells(6).Text.Replace("-", vbCrLf + "-")
       Next

I also tried <br>, no luck

Thanks for any help or infomation.
Elmo Watson - 06 Mar 2008 20:16 GMT
You'll need to start with:

If e.Row.RowType = DataControlRowType.DataRow Then  (of course add your
code, and then End If)

then try:
dgItem.Cells(6).Text=dgItem.Cells(6).Text.Replace("-", vbCrLf + "-")

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup

> Is there any way for gridview cells to observe vbcrlf in the data?
>
[quoted text clipped - 8 lines]
>
> Thanks for any help or infomation.
Alexey Smirnov - 06 Mar 2008 20:22 GMT
On Mar 6, 8:53 pm, wild...@noclient.net wrote:
> Is there any way for gridview cells to observe vbcrlf in the data?
>
[quoted text clipped - 8 lines]
>
> Thanks for any help or infomation.

dgItem.Cells(6).Text.Replace("-", vbCrLf + "-") would replace "-" by
the vbCrLf + "-" what makes no sense for the browser if you don't use
<pre> tag that preserves line breaks. Changing to "<br/>-" should make
a break in the text
Peter Bromberg [C# MVP] - 06 Mar 2008 20:54 GMT
dgItem.Cells(6).Text.Replace("-", "<br/>-")

should work, unless the content is actually in a child control in the cell
such as a label.

-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net

> Is there any way for gridview cells to observe vbcrlf in the data?
>
[quoted text clipped - 8 lines]
>
> Thanks for any help or infomation.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.