how to render html tags on gridview from database

I have grid view to display techs notes. I am trying to force the grid view to display it as user enterd in text area

note: the grid view display the note in one line without break line or orderlist

example user Enter look like this

-hello World 1

-hello World 2

-hello World 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque gravida nibh mauris. Nam sit amet orci quis justo lacinia dictum nec vitae elit. Integer id nulla vitae nunc aliquam fringilla. Donec et nibh et odio ultrices cursus et quis lectus. Vestibulum ac tellus sit amet elit ullamcorper adipiscing. Quisque eu nisi eros. Integer dignissim, mi id tempus cursus, nisl dui euismod massa, adipiscing tincidunt dolor turpis ac magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;


I don't know of any ready made way to do this. So just convert newlines to <br> tags and make other needed changes manually.

Or you can do something a little more fancy by converting newlines into new HTML paragraphs like I did in my article Converting Text to HTML.

You can try with this code

var input = "-hello World 1 -hello World 2";
var result = input.Replace("-",Environment.NewLine + "-" );

Its because when you entered the data in text area. It generates \n or \r for new line. And in terms of html it doesn't break the line. So the solution is replace these characters with tag.

for example in the bind expression use this :

<%# Convert.ToString(Eval("Content")).Replcae("\n","<br />").Replcae("\r","<br />") %>

Hope this will help !!

Need Your Help


ruby-on-rails deployment haml

I am facing this runtime error after deploying mysite to VPS. note that in my local machine every thing is working fine.

Java: Class<T> and Class: Difference when used from within/ outside of the class

java generics class constructor parameters

I have a class that needs to use a Class&lt;T&gt; parameter (see my previous semi-related question). It is:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.