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

HTML code show error on RadComboBox

3 Answers 124 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sushobhit
Top achievements
Rank 2
Sushobhit asked on 14 Sep 2012, 02:49 PM
Hi all

 I have a  RadComboBox in asp.net and i have used  AllowCustomText="true" . so that way if user does not want to select the pre enter value he/she can enter his own value in radcombo box . but when a user can enter any element such like <b>,<br> mean any html tag and press enter button for submitting data it show error . i have create a java script code that removed <> before any text on blur event and it working fine to me but when i click to save the document it show error page . How can i solve this problem ?



Thanks all 

Sushobhit Raman

3 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 17 Sep 2012, 02:31 PM
Hi Sushobhit,

The reason you have faced such an exception is that ASP.NET prevents from processing unencoded HTML content submitted to the server. Here you could find a help article, where you could observe how to disable this restriction and eventually apply your own custom validation.

All the best,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Sushobhit
Top achievements
Rank 2
answered on 18 Sep 2012, 08:54 AM
Hi Nencho
 
Thanks for your suggestion but i need to that when user enter the nay HTML tag in the the code can remover HTML <> sigh. for example suppose user can enter <HTML>,<BR>,<a> etc when user can submit it then  <>  symbol  can remove only text can save 


Thanks in advance
Sushobhit Raman 

0
Princy
Top achievements
Rank 2
answered on 19 Sep 2012, 06:43 AM
Hi Sushobhith,

Try setting the following in web.config to allow html content in input.

web.config 
<system.web >
    <httpRuntime requestValidationMode="2.0" />
</system.web >

And you can remove html tags in javascript as follows.

JS:
<script type="text/javascript">
function OnClientSelectedIndexChanging(sender, args)
{
   var text = sender.get_text();
   text = text.replace(/</g, "");
   text = text.replace(/>/g, "");
   sender.set_text(text);
   sender.set_value(text);
}
</script>

Hope this helps.

Thanks,
Princy.
Tags
General Discussions
Asked by
Sushobhit
Top achievements
Rank 2
Answers by
Nencho
Telerik team
Sushobhit
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or