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

Custom validator didn't fire when I am using RadMultiPage and tabstrip

1 Answer 52 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Dorababu
Top achievements
Rank 1
Dorababu asked on 26 Jun 2012, 12:36 PM
I am having my design with radtabstrip and RadMultiPage as follows
<telerik:RadTabStrip ID="rdtabEmployee" runat="server" MultiPageID="rdmpPersonal"
            UnSelectChildren="True" Skin="WebBlue" EnableEmbeddedSkins="False" ClickSelectedTab="True"
            SelectedIndex="0" OnTabClick="tabClick">
            <Tabs>
                <telerik:RadTab runat="server" Text="Personal" PageViewID="rdpgPersonal">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="Contact" PageViewID="rdpgContact">
                </telerik:RadTab>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="rdmpPersonal" runat="server">
            <telerik:RadPageView ID="rdpgPersonal" runat="server" Selected="true">
                <telerik:RadPanelBar runat="server" ID="rdpnlPersonal" ExpandMode="FullExpandedItem"
                    Skin="Vista" EnableEmbeddedSkins="false" Width="880px">
                    <Items>
                        <telerik:RadPanelItem Expanded="true" Text="Employee Personal Information" runat="server"
                            Selected="true">
                            <Items>
                                <telerik:RadPanelItem Value="AccountInformation" runat="server">
                                    <ItemTemplate>
                                        <label>
                                            Demop
                                        </label>
                                        <telerik:RadDatePicker ID="RadDatePicker1" Width="200px" runat="server" MinDate="1900-01-01"
                                            TabIndex="5">
                                            <Calendar ID="Calendar1" RangeMinDate="1900-01-01" runat="server">
                                            </Calendar>
                                        </telerik:RadDatePicker>
                                        <telerik:RadDatePicker ID="radDtHiredate" Width="200px" runat="server" MinDate="1900-01-01"
                                            TabIndex="5">
                                            <Calendar ID="calHire" RangeMinDate="1900-01-01" runat="server">
                                            </Calendar>
                                        </telerik:RadDatePicker>
                                        <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="validatehiredate"
                                            SetFocusOnError="true" ControlToValidate="RadDatePicker1" ValidationGroup="accountValidation"
                                          ForeColor="Red"  Display="Dynamic">Can not Hire Guy less than 18 yrs</asp:CustomValidator>
                                        <br />
                                        <button onclick="javascript: NextDay(event); return false">
                                            Move to next day</button>
                                        <telerik:RadButton ID="rdbtnpersonalSaveNext" ValidationGroup="accountValidation"
                                            OnClick="rdbtnpersonalSaveNext_Click" TabIndex="11" runat="server" Text="Save & Next">
                                        </telerik:RadButton>
                                    </ItemTemplate>
                                </telerik:RadPanelItem>
                            </Items>
                        </telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelBar>
            </telerik:RadPageView>
            <telerik:RadPageView ID="rdpgContact" runat="server">
                <telerik:RadPanelBar runat="server" ID="RadPanelBar1" ExpandMode="FullExpandedItem"
                    Skin="Vista" EnableEmbeddedSkins="false" Width="880px">
                    <ItemTemplate>
                        <asp:TextBox ID="txtDemo" runat="server">
                        </asp:TextBox>
                    </ItemTemplate>
                </telerik:RadPanelBar>
                <label>
                    Demo Contact
                </label>
            </telerik:RadPageView>
</telerik:RadMultiPage>

When I click on second Tab and came back to first tab the custom validation which i had written fails, can some one help me..

<telerik:RadCodeBlock runat="server" ID="radcb">
            <script type="text/javascript" language="javascript">
                function monthDiff(d1, d2) {
                    var months;
                    var date1 = new Date(d1);
                    var date2 = new Date(d2);
                    return (date1 - date2) / (1000 * 60 * 60 * 24);
                    return months;
                }
 
                //function getLeapYear
 
                function difference(d1, d2) {
                    var diff = 18 * 12;
                    var Age = monthDiff(d1, d2);
 
                    var compareVal = 365 * 18; //getCompareVal(hiredate,dob);
 
                    if (Age >= compareVal) {
                        return true;
                        //true
                    } else {
                        return false; //false
                    }
                }
                function validatehiredate(value, arg) {
                    var datePicker = $find('<%= rdpnlPersonal.FindItemByValue("AccountInformation").FindControl("radDtHiredate").ClientID %>');
                    var datePicker1 = $find('<%= rdpnlPersonal.FindItemByValue("AccountInformation").FindControl("RadDatePicker1").ClientID %>');
 
                    var date = datePicker.get_selectedDate();
                    var date1 = datePicker1.get_selectedDate();
                    arg.IsValid = (difference(date, date1));
                }
            </script>
        </telerik:RadCodeBlock>

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 02 Jul 2012, 11:05 AM
Hi,

I've made a sample page using the provided implementation trying to reproduce the experienced problem, but to no avail. Here is a video of my tests. In order to troubleshoot this issue, open a support ticket and provide a runnable sample page so we could test and debug it locally.

Kind regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TabStrip
Asked by
Dorababu
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or