2 posts, 0 answers
  1. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 17 Oct 2013 Link to this post

    I am trying RequiredFieldValidator with RadDropDownList but i cannot manage to capture when no item is selected.
    Please, see below the code which implements it. 
    It is possible that setting DefaultMessage causes that always there is an item selected and requiredfieldvalidator never notifies that?

    telerik:RadDropDownList ID="Indicator_Period" runat="server" DefaultMessage="Select period">
                                            <telerik:DropDownListItem Text="Dayly" Value="d" />
                                            <telerik:DropDownListItem Text="Monthly" Value="m" />
                                            <telerik:DropDownListItem Text="Bimonthly" Value="b" />
                                            <telerik:DropDownListItem Text="Three-monthly" Value="t" />
                                            <telerik:DropDownListItem Text="Four-monthly" Value="c" />
                                            <telerik:DropDownListItem Text="Six-monthly" Value="s" />
                                            <telerik:DropDownListItem Text="Yearly" Value="a" />
                                    <asp:RequiredFieldValidator ID="Indicator_Period_RequiredFieldValidator" runat="server" ErrorMessage="*" ControlToValidate="Indicator_Period" ValidationGroup="AddIndicatorValidationGroup" ForeColor="Red"></asp:RequiredFieldValidator>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Save" ButtonType="StandardButton"
            OnClick="SaveIndicator" ValidationGroup="AddIndicatorValidationGroup">
            <Icon PrimaryIconCssClass="rbSave" PrimaryIconLeft="4" PrimaryIconTop="4"></Icon>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Oct 2013 Link to this post

    Hi Sonia,

    RadDropDownList does not have any known issues with ASP RequiredFieldValidator. I have tried the code you posted and it works fine at my end. The DefaultMessage displayed in the RadDropDownList wont be treated as a selected item and it wont interfere the working of the RequiredFieldValidator. Also check whether you are setting any InitialValue to the RequiredFieldValidator some where from the code which can affect the working of the RequiredFieldValidator.

  3. DevCraft R3 2016 release webinar banner
Back to Top