473,803 Members | 3,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid and Htmlencode

Welcome.
I have a common problem with the datagrid: when the data source contains
html tags (<script>docume nt.location.hre f='www.badsite. com'</script> for
example) the page with the datagrid becomes unsafe. I have found two
possible solutions in the net:
- using template columns and HTMLEncode
- using ItemCreated event of the datagrid
Both method works but the grid grows drasticly. And when I have
dynamicly created SQL query, used with AutoGenerateCol umns property the
above methods do not apply.

I think the better solution is extending the datagrid in such way, that
the ServerHTML encode will be called on every bound column (without touching
hyperlink , template, etc columns). The problem is that I have to little
experience in writting controls to manage that. I don't know which methods
should be ovverriden and how. I think, something like "CreateItem " or
"InitializeItem " - but I'm totally mixed.
Could you point me in the right direction? (absolutly don't want the
ready code, I just need some ideas)

Regards
Nov 17 '05 #1
0 3092

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1982
by: Nedu N | last post by:
Hi, I want to display the XML tags (for the the XML tags is the data that is stored in a table) on the datagrid using the datasets. But since the data itself is the XML tag it doesn't appera on the datagrid since it tries to parse the data before it displays. Using Server.HtmlEncode, i was able to display the right content on the datagrid for each and every colum using Template column. But i don't want to use any template columns...
2
1152
by: SKG | last post by:
i have a datagrid which has to display values like <Main> and <SubMain> But then they appear to be blank. I found when these values are placed in datagrid cells <td></td> they do not show. how can i display them. Thank!!!
1
1354
by: M | last post by:
I would thought the DataGrid would HtmlEncode everything before displaying. It appears that it does not. Isn't that a security concern? Anyway to force the DataGrid to HtmlEncode? Thanks.
1
2396
by: the friendly display name | last post by:
Simple question: How to make datagrid paging work without javascript? I have a simple datagrid, which gets populated by a dataview, it works perfectly, paging works too, but, as I said, it does only with javascript. I know how to set the index of the grid etc. My Idea would be using my own links (with query-parameters attached on them, the parameter would transport the position of the targeted page in the grid) I just need basicaly a...
0
1757
by: Erik | last post by:
Why isn't my update method getting called? Pasted below is an aspx from a 1.1 application I'm working on. It has two textboxes and a button for inserting data into the database, and a datagrid for editing and deleting data. When a user clicks on the "Edit" button in the datagrid, Edit() method is called and the appropriate row is changed into textboxes. And if user clicks on the "Update" button, the Update() method is fired. But if...
3
2106
by: Greg Collins [Microsoft MVP] | last post by:
I have a SQL2005 XML column I load into a DataSet. I then bind to a DataGrid. If I set an asp:Literal text value to the DataSet.GetXml() when I first load it into the DataSet, it displays correctly. If I later try to display the XML content in the asp:Literal control, then I get "<NewDataSet />". Why is that? Why can't I get the actual XML back from the DataSet? I'm new to DataSets, so I'm probably just missing something basic. Here's...
6
2003
by: LamSoft | last post by:
I have a cell in the datagrid, which the original data is as following: Testing1 Testing2 Testing3 Testing4 There are 4 lines, while it displays on the browser, it shows as a line, and I tried to replace "\r\n" to <br/>, but the smart ASP helps me to translate <br/into &quot;&lt;br/&gt; , so the <br/is useless here.... How can I do
5
2894
by: =?Utf-8?B?SnVsaWEgQg==?= | last post by:
Hi all I've got a datagrid with column with the numeric format {0:F2}. However this format expression does not give the numbers comma separators, which I need. I can't use the currency format, because I've got multiple currencies and currency format automatically picks up your local currency. I've searched everywhere for examples and can't find what I need. Has anyone got any help they could give me please?
0
1661
by: webaccess | last post by:
Hi Friends ..!! I want to use datagrid/dataview control to data in tablular format,also I want to add paging and format the data of table column. Problem is data is coming from API Dom in as XML source. Now to display data i hv use dataset to fetch data.so i m displaying data in datagrid/dataview. Now here comes a problem: Using Datagrid :
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.