I have an application with some telerik:RadComboBox and asp:RequiredFieldValidator to validate empty value. But it's not working and it's not validating. I checked the radscript manager and I have an error (Error Creating Control).
I had the application with NET Framework 2.0 and I changed to NET Framework 3.5. I have instaled Telerik ASP NET Q1 2010
Is it compatible that version of telerik with .NET framework 3.5?
What does the problem with combobox validation?
this si my html:
<telerik:RadComboBox ID="lstCountry" runat="server" AutoPostBack="True"
onselectedindexchanged="lstCountry_SelectedIndexChanged" SkinID="DropDownList"
TabIndex="17" Width="240px" >
</telerik:RadComboBox>
<asp:RequiredFieldValidator ID="rfvCountry" runat="server"
ControlToValidate="lstCountry" ErrorMessage="Country is required" InitialValue=""
SkinID="RequiredFieldValidator" ValidationGroup="vgpSave" Text="*">
</asp:RequiredFieldValidator>
Regards
Jose
8 Answers, 1 is accepted
Yes, 2010 Q1 release is compatible with .Net Framework 2.0, 3.5 and 4.0.
I have tested your scenario with version 2010.1.309.35, and the RequiredFieldValidator works as expected, it is activated when the input field of the RadComboBox contains no text.
Here is what I have been testing:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AutoPostBack
=
"true"
OnSelectedIndexChanged
=
"RadComboBox1
_SelectedIndexChanged"
SkinID
=
"DropDownList"
TabIndex
=
"17"
Width
=
"240px"
>
<
Items
>
<
telerik:RadComboBoxItem
Value
=
""
Text
=
""
/>
<
telerik:RadComboBoxItem
Value
=
"value2"
Text
=
"item2"
/>
<
telerik:RadComboBoxItem
Value
=
"value3"
Text
=
"item3"
/>
<
telerik:RadComboBoxItem
Value
=
"value3"
Text
=
"item3"
/>
</
Items
>
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"rfvCountry"
runat
=
"server"
ControlToValidate
=
"RadComboBox1"
ErrorMessage
=
"Country is required"
SkinID
=
"RequiredFieldValidator"
>
</
asp:RequiredFieldValidator
>
If you are still having troubles, could you please send us a support ticket with a running sample page attached to it, so we will be able to troubleshoot the issues locally.
Kind regards,
Ivana
the Telerik team

Ok, But when I set a dynamic list to radcombobox it not validate empty values.
For example: lstCountry is a dynamic list from database
<telerik:RadComboBox ID="lstCountry" runat="server" AutoPostBack="True"
onselectedindexchanged="lstCountry_SelectedIndexChanged" SkinID="DropDownList"
TabIndex="17" ToolTip="Country"
Width="240px">
</telerik:RadComboBox>
<asp:RequiredFieldValidator ID="rfvCountry" runat="server"
ControlToValidate="lstCountry" ErrorMessage="Country is required" InitialValue=""
SkinID="RequiredFieldValidator" ValidationGroup="vgpSave" Text="*">
</asp:RequiredFieldValidator>
Here the filling of the list:
public void ShowCountries(List<NumberTO> lCountries)
{
lstCountry.Items.Clear();
lstCountry.DataSource = lCountries;
lstCountry.DataTextField = "Country";
lstCountry.DataValueField = "Country";
lstCountry.DataBind();
lstCountry.Items.Insert(0, new RadComboBoxItem("", ""));
}
Regards
Jose

I have tried the same and it worked as expected. I am using the version 2011, 2, 915, 35. Here is the sample code.
CS:
protected
void
Page_Load(
object
sender, EventArgs e)
{
String s =
"select FirstName,EmployeeID from Employees"
;
con.Open();
SqlDataAdapter dr =
new
SqlDataAdapter(s, con);
DataTable dt =
new
DataTable();
dr.Fill(dt);
con.Close();
rcmb1.DataSource = dt;
rcmb1.DataTextField =
"EmployeeID"
;
rcmb1.DataValueField =
"FirstName"
;
rcmb1.DataBind();
rcmb1.Items.Insert(0,
new
RadComboBoxItem(
""
));
}
ASPX:
<
telerik:RadComboBox
ID
=
"rcmb1"
runat
=
"server"
>
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"ReqiredFieldvalidator1
"
runat
=
"server"
ControlToValidate
=
"rcmb1"
ErrorMessage
=
"Value is required"
Text
=
"*"
>
</
asp:RequiredFieldValidator
>
Thanks,
Princy.
Could you please open a support ticket and send us a runnable sample page with the behavior in question reproduced in it? This way we will be able to troubleshoot the issues locally, and determine where the problem comes from.
Regards,
Ivana
the Telerik team

I have some radcombobox in my aspx page and I have validate it.
The code is below
<telerik:RadComboBox ID="RcFilterchanged" runat="server" CssClass="GridTextBoxTXT" EmptyMessage="- Choose one -">
<Items>
<telerik:RadComboBoxItem Text="- Choose one -" Value="0" />
<telerik:RadComboBoxItem Text="Yes" Value="1" />
<telerik:RadComboBoxItem Text="No" Value="2" />
</Items>
</telerik:RadComboBox>
<br />
<asp:RequiredFieldValidator runat="server" ID="Rq5" InitialValue="- Choose one -"
ControlToValidate="RcFilterchanged" ValidationGroup="S1" ErrorMessage="Please Choose one"
CssClass="validator" />
If I remove the EmptyMessage in radcombobox, the validation work fine. At the Same time in my radcombobox have EmptyMessage its not work.. what the reason.?
Thanks Advance..

Please do the following modifications in your code snippet which works fine at my end.
ASPX:
<
telerik:RadComboBox
ID
=
"RcFilterchanged"
runat
=
"server"
CssClass
=
"GridTextBoxTXT"
ValidationGroup
=
"S1"
EmptyMessage
=
"- Choose one -"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"Yes"
Value
=
"1"
/>
<
telerik:RadComboBoxItem
Text
=
"No"
Value
=
"2"
/>
</
Items
>
</
telerik:RadComboBox
>
<
br
/>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"Rq5"
ControlToValidate
=
"RcFilterchanged"
ValidationGroup
=
"S1"
ErrorMessage
=
"Please Choose one"
CssClass
=
"validator"
/>
Let me know if you have any concern.
Thanks,
Shinu.

Thanks for quick reply. It's work fine.
I have another one issue in Radcombobox application. In My Radcombobox have a check box option. now its have 10 items (ex. Item1, Item2 ... Item10). At first in add mode I have selected 3 values (ex Item2, Item 5 and Item9) and it saved to backend. Now In my edit mode how to select the existing selected 3 items.
Thanks..

Please have a look into the sample code snippet which works fine at my end.
ASPX:
<
telerik:RadComboBox
ID
=
"RcFilterchanged"
runat
=
"server"
CssClass
=
"GridTextBoxTXT"
CheckBoxes
=
"true"
ValidationGroup
=
"S1"
EmptyMessage
=
"- Choose one -"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"Item1"
Value
=
"1"
/>
<
telerik:RadComboBoxItem
Text
=
"Item2"
Value
=
"2"
/>
<
telerik:RadComboBoxItem
Text
=
"Item3"
Value
=
"3"
/>
<
telerik:RadComboBoxItem
Text
=
"Item4"
Value
=
"4"
/>
<
telerik:RadComboBoxItem
Text
=
"Item5"
Value
=
"5"
/>
<
telerik:RadComboBoxItem
Text
=
"Item6"
Value
=
"6"
/>
<
telerik:RadComboBoxItem
Text
=
"Item7"
Value
=
"7"
/>
<
telerik:RadComboBoxItem
Text
=
"Item8"
Value
=
"8"
/>
<
telerik:RadComboBoxItem
Text
=
"Item9"
Value
=
"9"
/>
<
telerik:RadComboBoxItem
Text
=
"Item10"
Value
=
"10"
/>
</
Items
>
</
telerik:RadComboBox
>
<
br
/>
<
telerik:RadButton
ID
=
"radbtnSaveItem"
runat
=
"server"
Text
=
"Save Checked Items"
OnClick
=
"radbtnSaveItem_Click"
>
</
telerik:RadButton
>
<
telerik:RadButton
ID
=
"radbtnEditItem"
runat
=
"server"
Text
=
"Get Checked Items"
OnClick
=
"radbtnEditItem_Click"
>
</
telerik:RadButton
>
C#:
public
static
string
[] checkedItems =
new
string
[10];
protected
void
radbtnSaveItem_Click(
object
sender, EventArgs e)
{
int
index = 0;
foreach
(RadComboBoxItem item
in
RcFilterchanged.CheckedItems)
{
checkedItems[index] = item.Text;
//saving all checked items in the string array
index++;
}
RcFilterchanged.ClearCheckedItems();
}
protected
void
radbtnEditItem_Click(
object
sender, EventArgs e)
{
for
(
int
index = 0; index < checkedItems.Length; index++)
{
if
(checkedItems[index] !=
null
)
{
//accessing the previously checked items and setting it as checked
RadComboBoxItem item = RcFilterchanged.FindItemByText(checkedItems[index])
as
RadComboBoxItem;
item.Checked =
true
;
}
else
break
;
}
}
Let me know if you have any concern.
Thanks,
Shinu.