Rad window in side validation

2 posts, 0 answers
  1. NA
    NA avatar
    39 posts
    Member since:
    Aug 2013

    Posted 26 Feb 2014 Link to this post

    Rad window in side validation, i given validation initially to 2 rad text box fields  ,I have 3[R1,R2.R3] Rad combo box  if i select R1 combobox  no validation, when i select R2 combo box must and should select R3 combo box,
    just like same when i select R3 combo box must and should select R2,
    I have set condition but always fire previous validation when I refresh the validation fire correctly 
       {I using requiredfieldvalidator and validation group  to all fields ,the validation group to Rad Button,this functionality done after click rad button }


        pls help me server side code


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

    Posted 26 Feb 2014 in reply to NA Link to this post

    Hi,

    Please try the following code snippet to achieve your scenario.

    ASPX:
    <telerik:RadWindow ID="RadWindow1" runat="server" VisibleOnPageLoad="true">
        <ContentTemplate>
            <telerik:RadComboBox ID="RadComboBox1" runat="server">
                <Items>
                    <telerik:RadComboBoxItem Text="Item1" />
                    <telerik:RadComboBoxItem Text="Item2" />
                </Items>
            </telerik:RadComboBox>
            <telerik:RadComboBox ID="RadComboBox2" runat="server" EmptyMessage="select" ValidationGroup="Group1">
                <Items>
                    <telerik:RadComboBoxItem Text="Item3" />
                    <telerik:RadComboBoxItem Text="Item4" />
                </Items>
            </telerik:RadComboBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ValidationGroup="Group2" ControlToValidate="RadComboBox2" ErrorMessage="required">
            </asp:RequiredFieldValidator>
            <telerik:RadComboBox ID="RadComboBox3" runat="server" EmptyMessage="select" ValidationGroup="Group2">
                <Items>
                    <telerik:RadComboBoxItem Text="Item5" />
                    <telerik:RadComboBoxItem Text="Item6" />
                </Items>
            </telerik:RadComboBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ValidationGroup="Group1" ControlToValidate="RadComboBox3" ErrorMessage="required">
            </asp:RequiredFieldValidator>
            <telerik:RadButton ID="RadButton1" runat="server" CausesValidation="true" Text="Validate" OnClick="RadButton1_Click1">
            </telerik:RadButton>
        </ContentTemplate>
    </telerik:RadWindow>

    C#:
    protected void RadButton1_Click1(object sender, EventArgs e)
    {
        if (RadComboBox3.Text == "" && RadComboBox2.Text=="")
        {
            RequiredFieldValidator1.IsValid = true;
            RequiredFieldValidator2.IsValid = true;
        }
        else if (RadComboBox2.Text == "")
        {
            RequiredFieldValidator1.IsValid = false;
        }
        else if(RadComboBox3.Text=="")
        {
            RequiredFieldValidator2.IsValid = false;
        }
    }

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