开发者

Use HtmlEncode in Details View TemplateItem Control

I have details view control in my asp.net web form, which on of its item template gets it is value from database, and show this into a richtextbox :

<FTB:FreeTextBox id="txtDescription" runat="Server" AllowHtmlMode="false" Text='<%# (Eval("Description")开发者_Go百科 )%>'
                >
                </FTB:FreeTextBox>

but when i click on insert or update button, i get the following error :

A potentially dangerous Request.Form value was detected from the client ....

i tried this :

Text='<%# HttpUtility.HtmlDecode((string)Eval("Description"))%>'

bu it did not work ethier, and i got the error again. is there any way except turning validateRequest off. Would you please help me?


No, there isn't a way to get this to work aside from turning Validate Request off. Which isn't a bad thing if you write your database functionality correctly and implement strict custom form validation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜