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

Rad window in side validation

1 Answer 43 Views
Window
This is a migrated thread and some comments may be shown as answers.
NA
Top achievements
Rank 1
NA asked on 26 Feb 2014, 02:02 PM
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


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Feb 2014, 05:09 AM
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.
Tags
Window
Asked by
NA
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or