473,948 Members | 23,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying line break in Datagrid

Hi,

I have a multiline textbox used to submit values stored as VarChar in my SQL
database. I need to be able to retrieve this string and display it in a
datagrid column with the line breaks entered in the textbox maintained.

Is there a prefered solution available for this ?

Niclas
Jun 3 '06 #1
2 3614
I would replace all occurences of vbCrLf i.e. character code 10 and 13
with the <BR/> tag. The datagrid outputs its contents as HTML and in
HTML whitespace characters such as vbCrLf are ignored. To specify line
breaks in HTML you have to specify the <BR/> tag in place of vbCrlf.

you can do this replacement at the point where you select your data
from the database in your select query. however, i prefer catching the
DataGrid's ItemDataBound event and fixing the data there - it might be
less efficient but its better in N-tier applications that I normally
write.

hope this helps bro

Jun 3 '06 #2
Works like a charm.

Many thanks

Niclas
<ta****@gmail.c om> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
I would replace all occurences of vbCrLf i.e. character code 10 and 13
with the <BR/> tag. The datagrid outputs its contents as HTML and in
HTML whitespace characters such as vbCrLf are ignored. To specify line
breaks in HTML you have to specify the <BR/> tag in place of vbCrlf.

you can do this replacement at the point where you select your data
from the database in your select query. however, i prefer catching the
DataGrid's ItemDataBound event and fixing the data there - it might be
less efficient but its better in N-tier applications that I normally
write.

hope this helps bro

Jun 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
22426
by: Roland Dalmulder | last post by:
Hello all, In my PHP script I put a text file into a string. Part of that string is read, changed and removed. The while loop continuest to extract the next part of the string. This goes all fine with one exception. When there is a line break in the second string that has the extract of the first string, it cannot find the words I am looking for as it stops looking when it hits the line break. For example:
5
10911
by: Wai Yip Tung | last post by:
When I do for line in fp: the line string usually has a '\n' at the end. In many cases I don't want the line break character. I can trim it using if line.endswith('\n'): line = line Given I do it so frequently I wonder if there is some builtin way to say I
5
29715
by: Kathryn | last post by:
Good morning! I am having a problem with a span. I have items, of which I only want to show the first X characters on the screen. If the user prints the page, I want the entire item to print. Thanks to Els, I have a way to do this, see below, directly from the View Source: This is a long piece of text. This is a long piece of text. This
6
16259
by: Nurchi BECHED | last post by:
Hello, All! I have created an application with a multiline textbox on the form. When I press a button, it has to show something and then break the line and show something else. I tried "\n", ((char)13) and ((char)10) - they don't work. When I enter a break by hand (just press enter) and run through each character in that string, the line break character has code 13 10 (yes, 2 numbers for some reason) The possible reason is that 'Enter'...
3
4937
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls are Web Control & not HTML control. One of these buttons whose title is Delete is added on the aspx page in design view & also I double clicked on this button in design view to get the onclick code for this button in the code behind page. & for...
9
2449
by: jsummit | last post by:
I'm trying to parse a rather large string from a .txt file that breaks into 2 lines ( the string is a fixed-length string reaching 6694 characters) into a dataset using VB.net. The issues that I am having is with the line breaks. I am able to parse the string into the dataset up in till the line breaks. My pattern is as follows.. "^(?<n0>.{1})(?<n1>.{8})(?<n2>.{2})..... (?<n404>.{2})$" My code is as follows: Dim re as New...
3
17384
by: lmawler | last post by:
Hi all, I know when I do data entry, I can force a line break in a text box by using Control & Enter. I'm trying to insert a line break in a field (that behaves like Control Enter) from VB. Anyone know the command for this? Here's what I want to do: rst2("Change") = rst2("Change") & **LINE BREAK *** & "Autopropagated Change to..."
4
5825
by: deerchao | last post by:
Hi, I'd like to render colorful text with word wrap on screen (kind of inline <fonttag to change text color in html), but run into the line break problem. Graphics provides several DrawString methods with line break features, but I can't make them draw different colors within one string, And if I split the string into several part, so I can specify their colors, line breaking won't work. So, I have to break my string to lines before...
7
4218
by: jeddiki | last post by:
Hi, I am using a function called htmlwrap() which states that it does NOT add a "<br>" to the 70 character line so that it forces a line wrap. ( the script safely wraps long words without destroying html tags which wordwrap has a tendency of doing! )) What I want to do is add that line break so that it DOES force a line wrap - but I am not sure where to insert it in the function
0
9989
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11182
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9898
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8258
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7432
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6120
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6341
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4543
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3548
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.