Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

new line character in gridview cell

Posted on 2009-03-31
2
Medium Priority
?
1,976 Views
Last Modified: 2012-05-06
How do I get newline characters to work in a gridview cell?

I have the query below for now.  It doesn't work, nor do any other newline characters when I reference the column in my gridview.  I want the address to be formatted like:

555 Test Dr.
Exam, FL. 55555

Instead I get:

555 Test Dr. \r Exam, FL. 55555
CREATE PROCEDURE dbo.usp_SEL_CL_Net_GetMortgageInformation
	@PolicyID AS VARCHAR(15),
	@InceptionDate AS SMALLDATETIME,
	@PostDate as DATETIME
AS
	Select [MortgageeID] AS 'Mortgagee Number', 
		[Name] AS 'Mortagee Name', 
		'Address' = CASE WHEN [Address2] = '' THEN
				[Address1] + ' \r ' + [City] + ', ' + [State] + '. ' + [ZipCode] 
			    ELSE
				[Address1] + ' \r ' + [Address2] + ' \r ' + [City] + ', ' + [State] + '. ' + [ZipCode]
			    END,
		[LoanID] AS 'Loan Number'
	From PlMortgage WITH (NOLOCK) 
	Where PolicyID = @PolicyID And 
		InceptionDate = @InceptionDate And 
		PostDate = @PostDate 
	Order by MortgageeID
GO

Open in new window

0
Comment
Question by:Unzip_The_Ripper
2 Comments
 
LVL 9

Accepted Solution

by:
vavjeeva earned 500 total points
ID: 24032158
set the htmlencode to false in gridview field and change the query from \r to <br\>

<asp:BoundField HtmlEncode=false ........../></Columns>

....

instead of
[Address1] + ' \r '

[Address1] + ' <br/> '
0
 

Author Closing Comment

by:Unzip_The_Ripper
ID: 31564966
Perfect.  This fixed it.  Thanks.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question