I have a WebDataGrid bound to an SQL data source which displays a single column of data. The definition looks like this
<ig:WebDataGrid ID="helpGRID" runat="server" Height="55%" Width="199px" AutoGenerateColumns="False" DataSourceID="helpSOURCE" > <Columns> <ig:BoundDataField DataFieldName="MenuItemCaption" Key="MenuItemCaption" HtmlEncode="true"> <Header Text="Help" /></ig:BoundDataField> </Columns> <Behaviors><ig:Paging></ig:Paging></Behaviors> </ig:WebDataGrid>
It displays the dorrect records but in spite of setting HtmlEncode true I still see simple HTML formatting commands in the text that is displayed:
If you do not have a current subscription, please click on the <b>Subscribe</b> item in the menu to purchase a subscription using our secure on-line shop.
instead of:
If you do not have a current subscription, please click on the Subscribe item in the menu to purchase a subscription using our secure on-line shop.
What am I doing wrong?
Kind regards
Paul
ASP.NET Version=10.3.20103.2088VS 2010Dev Sys: Win 7 Ult 64Bit 8GB RAM
This is often done when the database contains pre-formatted help text, product details, or descriptions for things like a gift shop where simple styling such as bold or italic makes the content clearer.
Be careful though: only use this if you trust the content, because displaying raw HTML can introduce security risks if the data source includes unsafe scripts.
Thanks Alexander,
That works! Seems strange to me that you set HTMLencode=false when you want the control to encode HTML - which is why I did not think to try it, but thanks again for taking time to post the solution.
Hello Paul,
Thank you for posting on Infragistics forum.
In order to display HTML content in “WebDataGrid” column you may try to set “HtmlEncode” property to “false”:
HtmlEncode="false"
Test your code with the property set to “false” and let me know what the results are.