Validation on RadComboBox

5 posts, 0 answers
  1. Rahul
    Rahul avatar
    39 posts
    Member since:
    Jan 2014

    Posted 07 Jan 2014 Link to this post


    on button click do a validation on RadCombobox

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Jan 2014 Link to this post

    Hi Rahul,

    Please have a look into the sample code snippet to Validate RadComboBox.

    ASPX:
    <telerik:RadComboBox ID="RadComboBox2" runat="server" EmptyMessage="--Select--">
        <Items>
            <telerik:RadComboBoxItem Text="Item1" runat="server" />
            <telerik:RadComboBoxItem Text="Item2" runat="server" />
            <telerik:RadComboBoxItem Text="Item3" runat="server" />
        </Items>
    </telerik:RadComboBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="RadComboBox2"
        ErrorMessage="Required">
    </asp:RequiredFieldValidator>
    <br />
    <telerik:RadButton ID="RadButton2" runat="server" Text="Submit">
    </telerik:RadButton>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rahul
    Rahul avatar
    39 posts
    Member since:
    Jan 2014

    Posted 07 Jan 2014 Link to this post

    Hi Shinu,
                  Thanks for Reply. Actually i want to validate on Country,State,City and Main Road and its depend each other.
    First time without selection I click the button they  Work  fine after that i select "Select Country" just empty message select they not work. so please suggest properly working example demo .

    Thanks,
    Rahul
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Jan 2014 Link to this post

    Hi Rahul,

    I guess that you are populating the RadComboBox from another RadComboBox based on some condition and you need to validate all the RadComboBox on Button Click. Please have a look into the following sample code snippet.

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" EmptyMessage="--Select--"
        OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
    </telerik:RadComboBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Required"
        ControlToValidate="RadComboBox1" ValidationGroup="Group1">
    </asp:RequiredFieldValidator>
    <telerik:RadComboBox ID="RadComboBox2" runat="server" AutoPostBack="True" EmptyMessage="--select--">
    </telerik:RadComboBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Required"
        ControlToValidate="RadComboBox2" ValidationGroup="Group1">
    </asp:RequiredFieldValidator>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Submit" ValidationGroup="Group1">
    </telerik:RadButton>

    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //code for generating first radcombobox
        }
    }
    protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        //code for generating second radcombobox
    }

    Please elaborate your requirement if it doesn't help.
    Thanks,
    Shinu.
  6. Rahul
    Rahul avatar
    39 posts
    Member since:
    Jan 2014

    Posted 07 Jan 2014 Link to this post

    Hi Shinu,
                 Thanks for sample code. it's works...

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