<asp:RequiredFieldValidator ID="rfvValidator" runat="server" ControlToValidate="rcbComboBox" Display="Dynamic" InitialValue="--Select--" ErrorMessage="Please select a value" />
And
<telerik:RadComboBox ID="rcbComboBox" runat="server" AllowCustomText="False" />
The combo box is bound in the code behind.
However when the page is displayed the validators are shown. They should only be shown after a selection has been made.
This worked fine in the RadControls.Net2 implementation.
Is there a known work around for this?
Thanks
Guido Tapia
5 Answers, 1 is accepted
I tried to reproduce the problem, but to no avail. Attached, please find a small and running project on the matter.
If the InitialValue of the RequiredFieldValidator is set to the text of the first item that is selected by default upon page_load, the ErrorMessage will be shown when the page is loaded. You can set some custom text to the combobox (using the Text property of the control and enabling the AllowCustomText property) so that the ErrorMessage is not shown when page loads.
Hope this helps.
Regards,
Nick
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Below is code that compares asp:DropDownList old radcontrol RadComboBox and telerik:RadComboBox (promethius). You will see that promithius behaves incorrectly.
NOTE: Setting the AllowCustomText to true is not a solution, it is an ugly work around at best. A much nicer work around is to do server side validation. I was hoping not to do that, so again I ask, is there any 'nice' work around to this bug.
Thanks
Guido Tapia
-------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Test" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadComboBox.NET2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="f" runat="server">
<asp:ScriptManager id="sm" runat="server"/>
<asp:Button id="postback" runat="server" Text="Empty Postback Test" />
<br/>
<h2>Expected Behaviour</h2><br/>
- Validator should not be shown on initial page load!!!!!!!
<br/>
<h1>asp:DropDownList</h1>
<asp:DropDownList id="ddl1" runat="server">
<asp:ListItem text="Select" />
<asp:ListItem text="Item 1" />
<asp:ListItem text="Item 2" />
<asp:ListItem text="Item 3"/>
</asp:DropDownList>
<asp:RequiredFieldValidator id="v1" runat="server" Display="Dynamic" ErrorMessage="Error 1" ControlToValidate="ddl1" InitialValue="Select"/>
<hr / >
<h1>rad:RadComboBox (Old RadControls)</h1>
<rad:RadComboBox id="ddl2" runat="server" AllowCustomText="false">
<Items>
<rad:RadComboBoxItem Text="Select" Selected="true"/>
<rad:RadComboBoxItem Text="Item 1" />
<rad:RadComboBoxItem Text="Item 2" />
<rad:RadComboBoxItem Text="Item 3" />
</Items>
</rad:RadComboBox>
<asp:RequiredFieldValidator id="v2" runat="server" Display="Dynamic" ErrorMessage="Error 2" ControlToValidate="ddl2" InitialValue="Select"/>
<hr / >
<h1>telerik:RadComboBox (Promithius)</h1>
<telerik:RadComboBox id="ddl3" runat="server" AllowCustomText="false">
<Items>
<telerik:RadComboBoxItem Text="Select" Selected="true"/>
<telerik:RadComboBoxItem Text="Item 1" />
<telerik:RadComboBoxItem Text="Item 2" />
<telerik:RadComboBoxItem Text="Item 3" />
</Items>
</telerik:RadComboBox>
<asp:RequiredFieldValidator id="v3" runat="server" Display="Dynamic" ErrorMessage="Error 3" ControlToValidate="ddl3" InitialValue="Select"/>
</form>
</body>
</html>
Thanks for bringing this to our attention. We will fix it for the service pack.
Regards,
Rosi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I'm having this problem too :(
The validator starts to show on the first page load.
We're in the middle of a development and we're about to buy the prometheus version...
How long will it take to release this service pack?
Fernandes
The service pack of Prometheus controls is scheduled to be released in the middle of January 2008.
Regards,
Rosi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
