BUG: Grid DTC Interprets HTML Tag as HTML (192033)
The information in this article applies to:
- Microsoft Visual Studio, Enterprise Edition 6.0
This article was previously published under Q192033 SYMPTOMS
The Grid Design-Time Control (DTC) interprets a table that contains an HTML tag such as <HR> as HTML rather than text. In this case, a horizontal rule is displayed in the cells of the DTC Grid rather than the text "<HR>."
CAUSE
All data from a database is put into the DTC Grid as raw text. The browser
simply processes this text as though it were any other HTML text.
RESOLUTION
The best solution is to format the data in the database in the way you want
it to appear. If you choose not to format the data in your database so that
it appears as HTML source code (see item 3), it must be converted
(see items 1 and 2).
Converting Your Data Before It Is Put into the DTC Grid- Go to the Custom property pages for the DTC Grid.
- On the Data tab in the Edit columns area, notice the Field/expression text box. If you prefix the data in this field with
an equal sign ("="), it is interpreted as JavaScript. If you enclose the name of a field with square brackets ("[]"), the grid displays the data for that field from the recordset in the DTC Grid.
Converting Data During Rendering of Grid- For ASP (server-side), use the following expression:
=Server.HTMLEncode([fieldname])
For DHTML (client-side), it is necessary to write a function to convert the string to display properly:
example: =MyHTMLEncode([field1])
See the example in MORE INFORMATION section. - Format the data in the database so it displays properly (<HR> rather than <HR>).
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 8/11/2005 |
---|
Keywords: | kbBug kbCtrl kbpending KB192033 |
---|
|