5,702,921 members and growing! (14,136 online)
Email Password   helpLost your password?
Languages » C# » General     Intermediate

Multi Line GridView Column Cell

By T.Ashraf

Display multi line of text saved in the database
VB, Javascript, XML, SQL, C# 1.0, C# 2.0, C#Windows, .NET, .NET 3.0, .NET 1.1, .NET 2.0, WinXP, Win2003, ASP.NET, WinForms, WebForms, Ajax, SQL 2000, SQL 2005, VS.NET2003, VS2005, SQL Server, Visual Studio, DBA, Dev

Posted: 12 Nov 2007
Updated: 12 Nov 2007
Views: 9,469
Bookmarked: 6 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
13 votes for this Article.
Popularity: 3.00 Rating: 2.69 out of 5
2 votes, 15.4%
1
4 votes, 30.8%
2
2 votes, 15.4%
3
3 votes, 23.1%
4
2 votes, 15.4%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

I was working on a project , where i have to retrieve that saved in the database and to be displayed in same cell but multi line since the data is saved in the format of <br>,it was easy for me to display it.

1- Create a new project using C#

2- Create a table in the database (SQL or MYSQL table or any other database)

Screenshot - T7.jpg

3- Save some data to the table for example

Screenshot - T6.jpg

4- Before you save the data to the table replace the \r\n with <br>

Screenshot - T5.jpg

5- Drag and drop GridView from the Tool Kit to the web form

6-Create the following coulmns

Screenshot - T1.jpg

7-Gridview will appears like this

Screenshot - T2.jpg

8- Change the propert of the Message column as show below

Screenshot - T3.jpg

9- Set the HtmlEncode to False

10 Write the code to fill the GridView here is a sample

Screenshot - T4.jpg

11- The data will appers like this.

Screenshot - T8.jpg

Background

It can be used to display text file data save in the database

Points of Interest

It was very nice and easy to display multi lines of text in one cell

what we need to do is to set the HtmlEncode property to False

History

Keep a running update of any changes or improvements you've made here.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

T.Ashraf


More than 9 years of experience in programming, design, architecture and development of various commercial object oriented application using C#, Visual Basic.net, ASP.net, relational database (SQL ,Oracle, MYSQL) in Window NT/2000/XP and UNIX environment. Experienced in client-server application development, data security management, third party tools and also has very good exposure to the entire Software Development Life Cycle viz. Requirements Collection and other Project Management activities.
WWW.TANVTECH.COM
Occupation: Software Developer (Senior)
Company: TANVTECH
Location: United States United States

Other popular C# articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 3 of 3 (Total in Forum: 3) (Refresh)FirstPrevNext
GeneralMy vote of 2memberDonsw17:55 26 Nov '08  
GeneralBetter title - Render HTML in GridView CellmemberJcmorin11:54 12 Nov '07  
GeneralRe: Better title - Render HTML in GridView CellmemberT.Ashraf20:08 12 Nov '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 12 Nov 2007
Editor:
Copyright 2007 by T.Ashraf
Everything else Copyright © CodeProject, 1999-2008
Web17 | Advertise on the Code Project