RadComboBox and Required Field Validator

8 posts, 1 answers
  1. Fernandes
    Fernandes avatar
    33 posts
    Member since:
    Mar 2005

    Posted 28 Jan 2008 Link to this post

    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!
  2. Answer
    Simon
    Admin
    Simon avatar
    2281 posts

    Posted 30 Jan 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian
    Brian avatar
    19 posts
    Member since:
    Apr 2007

    Posted 06 Feb 2008 Link to this post

    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
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 08 Feb 2008 Link to this post

    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
  6. Ashwin
    Ashwin avatar
    6 posts
    Member since:
    Apr 2013

    Posted 23 May 2013 Link to this post

    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>
  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 May 2013 Link to this post

    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.
  8. Muhammad
    Muhammad avatar
    6 posts
    Member since:
    Aug 2013

    Posted 29 Apr 2014 in reply to Princy Link to this post

    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?
  9. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Apr 2014 in reply to Muhammad Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017