This is a migrated thread and some comments may be shown as answers.

RadTextBox EmptyMessage unexpected behaviour

4 Answers 164 Views
Input
This is a migrated thread and some comments may be shown as answers.
Craig Wallace
Top achievements
Rank 1
Craig Wallace asked on 07 Jun 2010, 10:21 AM

Hi,

I have a simple RadTextBox and button as follows:

<telerik:RadTextBox ID="txtForename" runat="server" EmptyMessage="<first name>"></telerik:RadTextBox> 
<asp:button ID="btnGo" runat="server" text="Go" /> 

The problem is that .Net framework request validation is invoked on the value of EmptyMessage, as when I click the button I get:

Server Error in '/' Application.  
--------------------------------------------------------------------------------  
 
A potentially dangerous Request.Form value was detected from the client (Energy1_txtForename_text="<first name>").  

This is happening because of the <> in the EmptyMessage, but I thought no actual value would be stored or passed with the input?  How can I work around this without turning off request validation, but still retain my nice EmptyMessage?

Thanks.

Craig

4 Answers, 1 is accepted

Sort by
0
hari
Top achievements
Rank 1
answered on 08 Jun 2010, 09:09 AM
Hi Craig,

You can write client-side javascript validation for checking special characters on onclick of btnGo.
0
Craig Wallace
Top achievements
Rank 1
answered on 08 Jun 2010, 09:10 AM
Hi hari,

I think you misunderstand.  I want the special characters to exist in the EmtpyMessage, but surely they should not be validated in any way?

Craig
0
hari
Top achievements
Rank 1
answered on 08 Jun 2010, 10:00 AM
Hi Craig,

Then u have to use validateRequest=false in @page directive. This is one way to work around. But is not recommended. See the link http://www.asp.net/learn/whitepapers/request-validation.
0
Craig Wallace
Top achievements
Rank 1
answered on 08 Jun 2010, 10:02 AM
That is what I mean.  The EmptyMessage should not be validated.  Surely there is way to avoid this without having to disable request validation?

Craig
Tags
Input
Asked by
Craig Wallace
Top achievements
Rank 1
Answers by
hari
Top achievements
Rank 1
Craig Wallace
Top achievements
Rank 1
Share this question
or