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

RadComboBox and Required Field Validator

7 Answers 587 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Fernandes
Top achievements
Rank 1
Fernandes asked on 28 Jan 2008, 03:21 PM
Hi!

I'm trying to validate the content of a Prometheus ComboBox. But I'm facing a "small" problem. This is what I have:

- A RadComboBox;
- A RequiredFieldValidator (validating the combo)
- A button

When I press the button, it postbacks to the server, and after that, it shows the warning message saying that the field is not filled.

Shouldn't the validator validate the page on the Client? Please tell me that I'm missing something... Do I have to set any other properties on the combox to get this to work?

Thanks!

7 Answers, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 30 Jan 2008, 04:29 PM
Hi Fernandes,

Thank you for posting the issue. It turned out to be a bug with the RadComboBox "Prometheus", which is now logged in our bug tracking system.

You can find a workaround in the attached sample project.

We apologize for the caused inconvenience.


Sincerely yours,
Simeon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Brian
Top achievements
Rank 1
answered on 06 Feb 2008, 10:12 PM
Any idea when this bug fix will be available?  I have three projects that need to be put into production in the next 30 days and could really use the bug fix for this.

Is there a way to integrate this work around with the validation summary control?

Brian
0
Simon
Telerik team
answered on 08 Feb 2008, 04:28 PM
Hello Brian,

The bug fix will be included in the next Service Pack 2. However, if we manage to come up with solution earlier than the official release we will contact you again and provide you with an unofficial build.

For a temporary solution I suggest using another approach to the case: show/hide custom text labels, showing appropriate error messages. You can use either of these structures:
  • Unordered bulleted list with Labels in each item. Show/hide each bulleted item depending on the validated values.
  • <div> elements with 'bullet' pictures and Labels in them. Again show/hide divs depending on the validated values.
You could tweak the styles of the <ul> or <div> elements to match those of the RequiredFieldValidator (e.g. color, font, etc.).

I hope this is useful.
Greetings,
Simeon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ashwin
Top achievements
Rank 1
answered on 23 May 2013, 09:47 AM
Hello There,

I have a Rad Combo Box, I added a default item as "-- Select --" with value as "0" from code behind, This item is added because, my requirement is, user can select default value at any point of time. Anyway, I also want the Required Field validator to work with default value. If I set Initial Value property of my validator still it doesn't fire. 

Can anybody help me out in this case. 

<telerik:RadComboBox ID="rcmbTest" runat="server" Width="76%" Height="100px" MarkFirstMatch="true"                      AllowCustomText="true" DropDownAutoWidth="Disabled" Filter="StartsWith" />
 <asp:RequiredFieldValidator ID="ReqValTest" runat="server" ControlToValidate="rcmbTest" InitialValue="0"                                      ErrorMessage="Error" Display="Static"  SetFocusOnError="true" CssClass="error"  ></asp:RequiredFieldValidator>
0
Princy
Top achievements
Rank 2
answered on 24 May 2013, 07:43 AM
Hi,

Try setting InitialValue as "-- Select --" instead of 0.

ASPX:
<asp:RequiredFieldValidator ID="ReqValTest" runat="server" ControlToValidate="rcmbTest"  InitialValue="--Select--" ErrorMessage="Error" Display="Static" SetFocusOnError="true" CssClass="error"></asp:RequiredFieldValidator>

Thanks,
Princy.
0
Muhammad
Top achievements
Rank 1
answered on 29 Apr 2014, 03:36 PM
Hi, 

I have the similar issue with RadCombobox, Here is my scenario.

RadComboBox with Asp.net requiredFieldValidators, Latest Telerik Controls 2014

1. page is loaded and RadComboBox fills from database and its selected value and text is "--Select State--"
2. I pressed button and validator fires that says "Please select State"
3. I select a state e.g. Alaska
4. and immediately revert it back again to "--Select State--"
5. Now validator is not firing on button click.

 

<telerik:RadComboBox ID="ddlState" runat="server" Skin="Outlook" EmptyMessage="--Select State--"
                                                Width="125px" DataSourceID="SDSStates1" DataTextField="LocationStateName" DataValueField="LocationState">
                                            </telerik:RadComboBox>
                                            <asp:RequiredFieldValidator runat="server" InitialValue="--Select State--" ControlToValidate="ddlState"
                                                ErrorMessage="State is required." Display="Dynamic" ID="RequiredFieldValidator5">*</asp:RequiredFieldValidator>

<asp:SqlDataSource ID="SDSStates1" runat="server" ConnectionString="<%$ ConnectionStrings:AITConnectionString %>"
                                                SelectCommand="select  '--Select State--' AS LocationState , '--Select State--' AS LocationStateName
                                    UNION ALL
                                    select distinct LocationState , LocationStateName From Locations" SelectCommandType="Text"></asp:SqlDataSource>

Any Suggestion?
0
Princy
Top achievements
Rank 2
answered on 30 Apr 2014, 08:33 AM
Hi Muhammad,

Please have a look into the following code snippet which works fine at my end.

ASPX:
<telerik:RadComboBox ID="ddlState" runat="server" Width="125px" EmptyMessage="--Select State--"
    DataSourceID="SDSStates1" DataTextField="CountryName" DataValueField="CountryId"
    Skin="Outlook">
</telerik:RadComboBox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="ddlState" Display="Dynamic" ErrorMessage="State is required.">
</asp:RequiredFieldValidator>
<telerik:RadButton ID="RadButton1" runat="server" Text="Submit">
</telerik:RadButton>
<asp:SqlDataSource ID="SDSStates1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [CountryId], [CountryName] FROM [Country]"></asp:SqlDataSource>

Thanks,
Princy.

Tags
ComboBox
Asked by
Fernandes
Top achievements
Rank 1
Answers by
Simon
Telerik team
Brian
Top achievements
Rank 1
Ashwin
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Muhammad
Top achievements
Rank 1
Share this question
or