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

RadTab strip validation

5 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
hamda
Top achievements
Rank 1
hamda asked on 25 Apr 2010, 08:30 AM
hi,

I have a 3 tabs strip in my page and I want to perform validation as you move from one strip to another. I used requiredfield validator for textboxes and compare validator for combo boxes ,so when i fill tab1 it won't allow me to go to tab2 even if all data is valid in tab1.
I tried to use validationGroup for every tab, but it doesn't do validation at all.
how to do validation on all three tabs??

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Apr 2010, 11:22 AM
Helo Hamda,

Have you set the "CausesValidation" property of RadTabStrip to "True" ?

Regards,
Princy.

0
hamda
Top achievements
Rank 1
answered on 27 Apr 2010, 07:15 AM
Yes I did :(, what else can cause this?
0
Veronica
Telerik team
answered on 27 Apr 2010, 12:15 PM
Hi hamda ketbi,

Please take a look at this demo for example of validation.

Could you please provide your code so we are able to help you?

Thank you!

All the best,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
hamda
Top achievements
Rank 1
answered on 28 Apr 2010, 08:52 AM
This is my code:

<telerik:RadMultiPage ID="RadMultiPage1" Runat="server" Height="16px"   
                    SelectedIndex="0" Width="780px" BorderColor="#000099"   
            BorderStyle="Double">  
                    <telerik:RadPageView ID="RadShipView" runat="server" Height="16px"   
                        Selected="True">  
        <br /> 
        <table class="style1">  
            <tr> 
                <td class="style11" align="center" dir="rtl">  
                    <asp:Label ID="Label8" runat="server" Font-Bold="True" Text="اسم الوسيلة "   
                        CssClass="Label" ></asp:Label> 
                </td> 
                <td align="right" dir="ltr" class="style12">  
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"   
                        ControlToValidate="txtShipName" ErrorMessage="الرجاء ادخال البيانات">*</asp:RequiredFieldValidator> 
                    <telerik:RadTextBox ID="txtShipName" Runat="server" CausesValidation="True">  
                    </telerik:RadTextBox> 
                </td> 
            </tr> 
            <tr> 
                <td class="style4" align="center" dir="rtl">  
                    <asp:Label ID="Label9" runat="server" Font-Bold="True" Text="نوع الوسيلة "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadComboBox ID="ddlShipType" Runat="server"   
                        AppendDataBoundItems="True" DataSourceID="ObjectDataSource1"   
                        DataTextField="ShipTypeName" DataValueField="ShipTypeId" EmptyMessage="--اختر--"   
                        Skin="Outlook" ValidationGroup="g1">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;&#160;&#160;  
                    <asp:CompareValidator ID="CompareValidator1" runat="server"   
                        ControlToValidate="ddlShipType" ErrorMessage="الرجاء اختيار نوع الوسيلة"   
                        ValueToCompare="--اختر--" Operator="NotEqual"></asp:CompareValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style4" align="center" dir="rtl">  
                    <asp:Label ID="Label10" runat="server" Font-Bold="True" Text="قادمة من "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    &#160;<telerik:RadComboBox ID="ddlFromCountry" Runat="server"   
                        AppendDataBoundItems="True" DataSourceID="ObjectDataSource2"   
                        DataTextField="CountryName" DataValueField="CountryId" EmptyMessage="--اختر--"   
                        Skin="Outlook">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;&#160;&#160;  
                    <asp:CompareValidator ID="CompareValidator2" runat="server"   
                        ControlToValidate="ddlFromCountry" ErrorMessage="الرجاء اختيار الدولة"   
                        Operator="NotEqual" ValueToCompare="--اختر--"></asp:CompareValidator> 
                    &#160;&#160;  
                </td> 
            </tr> 
            <tr> 
                <td class="style4" align="center" dir="rtl">  
                    <asp:Label ID="Label11" runat="server" Font-Bold="True" Text="متجهة إلى "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadComboBox ID="ddlToCountry" Runat="server"   
                        DataSourceID="ObjectDataSource2" DataTextField="CountryName"   
                        DataValueField="CountryId" Skin="Outlook" EmptyMessage="--اختر--"   
                        AppendDataBoundItems="True">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;&#160;  
                    <asp:CompareValidator ID="CompareValidator3" runat="server"   
                        ControlToValidate="ddlToCountry" ErrorMessage="الرجاء اختيار الدولة"   
                        Operator="NotEqual" ValueToCompare="--اختر--"></asp:CompareValidator> 
                </td> 
            </tr> 
            <tr> 
                <td align="center" class="style4" dir="rtl">  
                    <asp:Label ID="Label13" runat="server" CssClass="Label" Font-Bold="True"   
                        Text="ترفع علم "></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadComboBox ID="ddlFlag" Runat="server"   
                        DataSourceID="ObjectDataSource2" DataTextField="CountryName"   
                        DataValueField="CountryId" Skin="Outlook" AppendDataBoundItems="True"   
                        EmptyMessage="--اختر--">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;&#160;  
                    <asp:CompareValidator ID="CompareValidator4" runat="server"   
                        ControlToValidate="ddlFlag" ErrorMessage="الرجاء اختيار الدولة"   
                        Operator="NotEqual" ValueToCompare="--اختر--"></asp:CompareValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style4" align="center" dir="rtl">  
                    <asp:Label ID="Label12" runat="server" Font-Bold="True" Text="المرفقات "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadComboBox ID="ddlAttachment" Runat="server"   
                        DataSourceID="ObjectDataSource3" DataTextField="FileName"   
                        DataValueField="AttachmentId" Skin="Outlook" AppendDataBoundItems="True"   
                        EmptyMessage="--اختر--">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;  
                </td> 
            </tr> 
            <tr> 
                <td class="style9" align="center" dir="rtl">  
                    <asp:Label ID="Label14" runat="server" Font-Bold="True"   
                        Text="رقم تعريف الوسيلة " CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" class="style10">  
                    <telerik:RadTextBox ID="txtShipId" Runat="server" CausesValidation="True">  
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"   
                        ControlToValidate="txtShipId">*</asp:RequiredFieldValidator> 
                </td> 
            </tr> 
            <tr> 
                <td align="center" class="style4" dir="rtl">  
                    <asp:Label ID="Label23" runat="server" Font-Bold="True" Text="الوكيل الملاحي "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right">  
                    <telerik:RadTextBox ID="txtCompany" Runat="server" CausesValidation="True">  
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"   
                        ControlToValidate="txtCompany">*</asp:RequiredFieldValidator> 
                </td> 
            </tr> 
            <tr> 
                <td align="center" class="style4" dir="rtl">  
                    <asp:Label ID="Label25" runat="server" Font-Bold="True"   
                        Text="عنوان الوكيل الملاحي " CssClass="Label"></asp:Label> 
                </td> 
                <td align="right">  
                    <telerik:RadTextBox ID="txtCompanyAddress" Runat="server"   
                        CausesValidation="True">  
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"   
                        ControlToValidate="txtCompanyAddress" ValidationGroup="g1">*</asp:RequiredFieldValidator> 
                </td> 
            </tr> 
            <tr> 
                <td align="center" class="style2" colspan="2">  
                    &#160;</td> 
            </tr> 
        </table> 
        <br /> 
        <br /> 
</telerik:RadPageView> 
<telerik:RadPageView ID="RadPersonView" runat="server" Height="16px">  
        <br /> 
        <table class="style1">  
            <tr> 
                <td class="style8" align="right" dir="rtl">  
                    <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="الاسم "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadTextBox ID="txtPersonName" Runat="server" CausesValidation="True">  
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"   
                        ControlToValidate="txtPersonName">*</asp:RequiredFieldValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style8" align="right" dir="rtl">  
                    <asp:Label ID="Label3" runat="server" Font-Bold="True" Text="الوظيفة "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadComboBox ID="ddlPersonType" Runat="server"   
                        DataSourceID="ObjectDataSource5" DataTextField="PersonTypeName"   
                        DataValueField="PersonTypeId" Skin="Outlook" EmptyMessage="--اختر--">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;&#160;  
                    <asp:CompareValidator ID="CompareValidator5" runat="server"   
                        ControlToValidate="ddlPersonType" ErrorMessage="الرجاء اختيار الوظيفة"   
                        Operator="NotEqual" ValueToCompare="--اختر--"></asp:CompareValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style8" align="right" dir="rtl">  
                    <asp:Label ID="Label2" runat="server" Font-Bold="True" Text="الجنسية "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadComboBox ID="ddlPersonCountry" Runat="server"   
                        DataSourceID="ObjectDataSource2" DataTextField="CountryName"   
                        DataValueField="CountryId" Skin="Outlook" EmptyMessage="--اختر--">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;&#160;  
                    <asp:CompareValidator ID="CompareValidator6" runat="server"   
                        ControlToValidate="ddlPersonCountry" ErrorMessage="الرجاء اختيار الجنسية"   
                        Operator="NotEqual" ValueToCompare="--اختر--"></asp:CompareValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style8" align="right" dir="rtl">  
                    <asp:Label ID="Label5" runat="server" Font-Bold="True" Text="رقم التعريف "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadTextBox ID="txtPersonId" Runat="server" CausesValidation="True">  
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server"   
                        ControlToValidate="txtPersonId">*</asp:RequiredFieldValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style8" align="right" dir="rtl">  
                    <asp:Label ID="Label6" runat="server" Font-Bold="True" Text="المرفقات "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadComboBox ID="ddlPersonAttachment" Runat="server"   
                        DataSourceID="ObjectDataSource3" DataTextField="FileName"   
                        DataValueField="AttachmentId" Skin="Outlook">  
                    </telerik:RadComboBox> 
                    &#160;  
                </td> 
            </tr> 
            <tr> 
                <td class="style8" align="right" dir="rtl">  
                    <asp:Label ID="Label7" runat="server" Font-Bold="True" Text="العنوان "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadTextBox ID="txtPersonAddress" Runat="server"   
                        CausesValidation="True">  
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"   
                        ControlToValidate="txtPersonName" ValidationGroup="g2">*</asp:RequiredFieldValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style8" align="right" dir="rtl">  
                    <asp:Label ID="Label22" runat="server" Font-Bold="True" Text="ملاحظات "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadTextBox ID="txtNotes" Runat="server">  
                    </telerik:RadTextBox> 
                </td> 
            </tr> 
            <tr> 
                <td align="center" class="style2" colspan="2">  
                    <asp:Button ID="AddPersonBtn" runat="server" onclick="AddPersonBtn_Click"   
                        Text="إضافة شخص جديد" CssClass="Button" /> 
                </td> 
            </tr> 
        </table> 
        <br /> 
        <br /> 
</telerik:RadPageView> 
<telerik:RadPageView ID="RadCargoView" runat="server" Height="16px">  
        <br /> 
        <table class="style1">  
            <tr> 
                <td class="style7" align="right" dir="rtl">  
                    <asp:Label ID="Label15" runat="server" Font-Bold="True"   
                        Font-Names="Arabic Transparent" Text="نوع الحمولة " CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    &#160;<telerik:RadComboBox ID="ddlCargoType" Runat="server"   
                        DataSourceID="ObjectDataSource4" DataTextField="CargoTypeName"   
                        DataValueField="CargoTypeId" Skin="Outlook" EmptyMessage="--اختر--">  
                        <Items> 
                            <telerik:RadComboBoxItem runat="server" Text="--اختر--" Value="--اختر--" /> 
                        </Items> 
                      
                    </telerik:RadComboBox> 
                    &#160;&#160;  
                    <asp:CompareValidator ID="CompareValidator7" runat="server"   
                        ControlToValidate="ddlCargoType" ErrorMessage="الرجاء اختيار نوع الحمولة"   
                        Operator="NotEqual" ValueToCompare="--اختر--"></asp:CompareValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style7" align="right" dir="rtl">  
                    <asp:Label ID="Label16" runat="server" Font-Bold="True"   
                        Font-Names="Arabic Transparent" Text="رقم المنفيست " CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <telerik:RadTextBox ID="txtMFTNumber" Runat="server" CausesValidation="True">  
                    </telerik:RadTextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"   
                        ControlToValidate="txtMFTNumber" ValidationGroup="g2">*</asp:RequiredFieldValidator> 
                </td> 
            </tr> 
            <tr> 
                <td class="style7" align="right" dir="rtl">  
                    <asp:Label ID="Label17" runat="server" Font-Bold="True" Text="الوسيلة "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" dir="rtl">  
                    <asp:Label ID="lblShip" runat="server" CssClass="Label"></asp:Label> 
                </td> 
            </tr> 
            <tr> 
                <td class="style5" align="right" dir="rtl">  
                    <asp:Label ID="Label24" runat="server" Font-Bold="True" Text="مالك الحمولة "   
                        CssClass="Label"></asp:Label> 
                </td> 
                <td align="right" class="style6" dir="rtl">  
                    <asp:Label ID="lblOwner" runat="server" CssClass="Label"></asp:Label> 
                </td> 
            </tr> 
            <tr> 
                <td align="center" class="style2" colspan="2">  
                    &#160;</td> 
            </tr> 
            <tr> 
                <td align="center" class="style2" colspan="2">  
                    <asp:Button ID="BtnInsertAll" runat="server" CssClass="Button" Height="27px"   
                        onclick="BtnInsertShip_Click" Text="Enter" Width="87px" /> 
                </td> 
            </tr> 
        </table> 
        <br /> 
        <br /> 
</telerik:RadPageView> 
                </telerik:RadMultiPage> 

Please help.
0
Veronica
Telerik team
answered on 29 Apr 2010, 03:55 PM
Hello hamda ketbi,

Thanks for the code.

Please take a look at the attached project for reference. You only need a RadTabStrip with MultiPageID set to the ID of the RadMultiPage and CausesValidation="true":

<telerik:RadTabStrip runat="server" ID="RadTabStrip1" MultiPageID="RadMultiPage1"
            CausesValidation="True" SelectedIndex="0">
            <Tabs>
                <telerik:RadTab Text="RadShipView">
                </telerik:RadTab>
                <telerik:RadTab Text="RadPersonView">
                </telerik:RadTab>
                <telerik:RadTab Text="RadCargoView">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>

Hope this helps.

Best wishes,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
hamda
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
hamda
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or