Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2003, 04:54 PM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting in DataGrid with SQLServer

I have a table with the fields:
zip, dname, address, city, phone.
and a stored procedure:

SELECT zip AS [Zip], dname as [Name], address + CHAR(13) + city AS [Address], phone AS [Phone]
FROM Dealers ORDER BY zip ASC
GO

and a DataGrid using only bound columns from the stored procedure.

My intent is to have only 3 columns in the DataGrid at run time, in which the middle column, Address, contains both address and city wtih a carriage return between output in the same Address column.

The result at run time is a DataGrid with 3 columns but no carriage return.

How can a carriage return be inserted in a column in a DataGrid.

Thanks for your help.


Sandra MacGregor
__________________
Sandy
 
Old November 29th, 2003, 11:16 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Even though you have a carriage return in the SQL, you won't see it in the rendered HTML. You should change it to a HTML break:

SELECT zip AS [Zip], dname as [Name], address + '<br>' + city AS [Address], phone AS [Phone]
FROM Dealers ORDER BY zip ASC
GO


Peter
------------------------------------------------------
Work smarter, not harder.
 
Old November 30th, 2003, 12:59 AM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Peter,

That works perfectly!

I'd tried putting <br> in the INSERT statement many ways to no avail, and didn't think of putting it in the sp.

Thanks a lot.



Sandra MacGregor





Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting datagrid column dates badgolfer VS.NET 2002/2003 12 August 9th, 2006 08:24 AM
Formatting e.Item.Cells in Datagrid rstelma ASP.NET 1.0 and 1.1 Professional 18 February 26th, 2006 07:34 AM
need help in Datagrid formatting prasadd ASP.NET 1.x and 2.0 Application Design 1 October 31st, 2005 11:09 AM
Formatting Datagrid reyboy General .NET 0 January 26th, 2005 10:24 PM
Beginner - Datagrid formatting question badgolfer VB.NET 2002/2003 Basics 1 November 18th, 2003 01:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.