I discover the problem come from the "<" and ">" characters. So if I replace my text to "[No selection]" then it work! Because I have no control, and don't want to, on values of the list I need to find a solution for this.
I tried to replace them by equivalent code ("<", ">") with no success. I also tried Server.HtmlEncode("<No selection>")but same thing. I also try the second technic as described in http://www.telerik.com/support/kb/aspnet-ajax/combobox/using-displaying-special-characters-in-radcombobox.aspx.
---------------------
I tried the demo located at http://demos.telerik.com/aspnet-ajax/combobox/examples/configurator/defaultcs.aspx and when I enter the value "<No selection>" in the Empty Message field then the entire page is gone! These characters are "killers"...
7 Answers, 1 is accepted
I have performed some tests, based on the provided information, but I was unable to replicate the experienced issue. Could you specify the version of our controls that you use at your end? In addition, I you like to ask you to provide us the implementation of the RadComboBox that you use.
Regards,
Nencho
the Telerik team
Here is my source code:
ASP.NET
<% @ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<% @ Register Assembly="Telerik.Web.UI, Version=2012.3.1205.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>
</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager Runat="server"></telerik:RadScriptManager>
<telerik:RadComboBox ID="cbxValues" runat="server" Width="250px" AutoPostBack="True">
</telerik:RadComboBox>
</div>
</form>
</body>
</html>
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
cbxValues.Items.Add(new Telerik.Web.UI.RadComboBoxItem("<None>", "-1"));
cbxValues.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Value 1", "1"));
cbxValues.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Value 2", "2"));
}
}
}
Thanks
The .NET framework is throwing an exception because it detects something in the entered text which looks like an HTML statement("<....>"). I can suggest you to set the validateRequest property of the Page to False. Please note that in .NET4 you also need to add
<httpRuntime requestValidationMode="2.0" />
in your web.config. In addition, please refer to the following forum thread, where this topic is discussed in details.Greetings,
Nencho
the Telerik team
I made a modification on your solution by setting the validateRequest in the web.config file to be applied on all pages as follow:
<configuration>
<system.web>
<httpRuntime requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
</configuration>
But I notice today, I don't know since when, the bug was re-introduced and it's no more possible to enter "<...>" values in a combo box :-(((
Is this will be fixed again in a new release... (currently I am using 2013.2.611
I don't know since when but now the bug appear again on a post-back using AJAX. So it's not on selecting the item with "<>" but when making the post-back.
Now I am using version 2013.2.618.
As previously mentioned, this is a .net limitation, which is implemented in order to prevent from processing unencoded HTML content submitted to the server. This is explained in details in this article. However, I tried to replicate the behavior, which you described with the 2012.3.1308 version of our controls. The same behavior persist with the specified version. Here is a video, demonstrating my tests.
Please correct me if I had missed something in my tests.
Regards,
Nencho
Telerik