Hi,
I have a Dropdown (autopostback enabled to perform some action) box inside an Update Panel. On the same page, I have a text box control which is outside the Update Panel. & there is no impact of Dropdown's autopostback on multiline Textbox.
Now, If user enters any text, which contains HTML tag, in Textbox & try to change the data of dropdown (means autopostback will be done), Asynchronous Post back fires an exception due to Textbox HTML data.
How can I stop this exception? there is no impact of dropdown's autopost back on Textbox & I am not sending textbox data to server while updating the update panel. I am checking the HTML text while I am submitting the page data. Drop down is populatng some
other controls inside update panel.
the update panel works by posting all the form data (via ajax), and running the full page lifecycle on the server, so you are sending the textbox data. when the sever completes the request rather than returning the full html, it returns the xml payload expected
by the update panel javascript.
As bruce said, your textbox data will be sent to server on post operation. Asp.Net by default throws an runtime exception if your page input control contains html markups to avoid CSS attack. You can either block users from entering html markups or set
the "ValidateRequest" property of page directive to false.
anujrathi
Member
193 Points
113 Posts
Problem with Update panel & HTML text in TextBox
Jan 05, 2013 02:45 PM|LINK
Hi,
I have a Dropdown (autopostback enabled to perform some action) box inside an Update Panel. On the same page, I have a text box control which is outside the Update Panel. & there is no impact of Dropdown's autopostback on multiline Textbox.
Now, If user enters any text, which contains HTML tag, in Textbox & try to change the data of dropdown (means autopostback will be done), Asynchronous Post back fires an exception due to Textbox HTML data.
How can I stop this exception? there is no impact of dropdown's autopost back on Textbox & I am not sending textbox data to server while updating the update panel. I am checking the HTML text while I am submitting the page data. Drop down is populatng some other controls inside update panel.
bruce (sqlwo...
All-Star
36850 Points
5445 Posts
Re: Problem with Update panel & HTML text in TextBox
Jan 05, 2013 10:35 PM|LINK
the update panel works by posting all the form data (via ajax), and running the full page lifecycle on the server, so you are sending the textbox data. when the sever completes the request rather than returning the full html, it returns the xml payload expected by the update panel javascript.
asteranup
All-Star
30184 Points
4906 Posts
Re: Problem with Update panel & HTML text in TextBox
Jan 07, 2013 03:19 AM|LINK
Hi,
In the page label set EnableEventValidation to false.
http://msdn.microsoft.com/en-in/library/system.web.ui.page.enableeventvalidation.aspx
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
mani2009it
Member
207 Points
82 Posts
Re: Problem with Update panel & HTML text in TextBox
Jan 07, 2013 06:26 AM|LINK
Hi,
As bruce said, your textbox data will be sent to server on post operation. Asp.Net by default throws an runtime exception if your page input control contains html markups to avoid CSS attack. You can either block users from entering html markups or set the "ValidateRequest" property of page directive to false.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CS.aspx.cs" Inherits="CS" ValidateRequest="false" %>