Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 October 5th, 2010, 06:37 AM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to astersathya
Default Data Grid Issue - Kindly Help Urgently

Hi All,

I am facing an issue. I have a datagrid in aspx page. I am binding a dataset data to this datagrid [simple binding]. It works with out any issues. However whenever the data contains any Html tags like 'Test Data With <HTML> tags'
the data in the datagrid cell will show only 'Test Data With <> tags'. The contents inside <> tag will disappear.

My code will look like this.

DataGrid.DataSource = SomeDataSet
DataGrid.DataBind()

I am using C# as the code behind language.

Kindly help with this.

Thanks in advance
Sathya
 
Old October 5th, 2010, 10:26 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Looks like your values are getting encoded. Maybe this helps?

http://msdn.microsoft.com/en-us/libr...tmlencode.aspx

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 6th, 2010, 03:09 AM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to astersathya
Default

Quote:
Originally Posted by Imar View Post
Looks like your values are getting encoded. Maybe this helps?

http://msdn.microsoft.com/en-us/libr...tmlencode.aspx

Imar
Dear Imar,

Really thank you for the quick response you have posted. However the problem with my code is the number of columns of the grid is not fixed. I mean to say the AutoGeneratedColumns Property of the gridview is true as I am not sure how many columns I retrieve from the SQL DB to bind the data to the Grid. The datapopulation is dynamic and depends on the SQL Query.

So in this case, I am not able to use the htmlencode ="false" property for the gridview control.

Any suggestion on this??

Awaiting your response...
 
Old October 6th, 2010, 08:11 AM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to astersathya
Default Data Grid Issue

Dear Imar,

Thanks for your qucik response and I appreciate it. However my datagrid generates the columns dynamically [ie., AutoGeneratedColumns property is set to true always] as data depends on the query.

I am not able to use the property 'htmlencode=false' in this case.

Kindly help.

Awaiting your response.
 
Old October 6th, 2010, 09:19 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Then you may be able to hook into some event such as RowCreated and programmatically set that property or decode the HTML. Google for some ideas.

Otherwise, define your columns explicitly.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Grid View Issue balesh.mind ASP.NET 2.0 Professional 0 September 20th, 2007 05:40 AM
Kindly help for datagrid complexity avixorld ASP.NET 2.0 Professional 0 July 30th, 2007 02:09 AM
Export data from data grid to excel pomoc VB.NET 2002/2003 Basics 0 December 16th, 2005 03:11 PM
Export data from data grid to Excel pomoc Visual Basic 2005 Basics 0 December 16th, 2005 02:56 PM
trying to load db data into data grid itsajourney Beginning VB 6 2 June 7th, 2005 12:05 PM





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