kelumKP / Sample-Codes

This is sample code 100% made by me for future references
0 stars 0 forks source link

Hand Over date rest according to Open Date : Ajax ToolKit CalenderExtender #16

Open kelumKP opened 8 years ago

kelumKP commented 8 years ago
                                                                       <div class="row">
                                                                                <div class="col-sm-4">
                                                                                    <div class="col-sm-4 padding0 labelText1">
                                                                                        Open Date    
                                                                                    </div>
                                                                                    <div class="col-sm-6 padding0">
                                                                                        <asp:TextBox ID="dtOpenDate" onkeypress="return RestrictSpace()" Enabled="false" CausesValidation="false" runat="server" CssClass="form-control"></asp:TextBox>
                                                                                    </div>
                                                                                    <div class="col-sm-1" style="padding-left: 3px;">
                                                                                        <asp:LinkButton ID="btFrom" runat="server" CausesValidation="false"> <span class="glyphicon glyphicon-calendar" aria-hidden="true"></span></asp:LinkButton>
                                                                                        <asp:CalendarExtender ID="CalendarExtenderfrom" runat="server" TargetControlID="dtOpenDate" Animated="true"
                                                                                            PopupButtonID="btFrom" Format="dd/MMM/yyyy" OnClientDateSelectionChanged="OpenDateChanged" >
                                                                                        </asp:CalendarExtender>
                                                                                    </div>
                                                                                </div>
                                                                                <div class="col-sm-4">
                                                                                    <div class="col-sm-4 padding0 labelText1">
                                                                                        H/O Date    
                                                                                    </div>
                                                                                    <div class="col-sm-6 padding0">
                                                                                        <asp:TextBox ID="dtHOvr" Enabled="false" CausesValidation="false" runat="server" CssClass="form-control"></asp:TextBox>
                                                                                    </div>
                                                                                    <div class="col-sm-1" style="padding-left: 3px;">
                                                                                        <asp:LinkButton ID="LinkButtonto" runat="server" CausesValidation="false"> <span class="glyphicon glyphicon-calendar" aria-hidden="true"></span></asp:LinkButton>
                                                                                        <asp:CalendarExtender ID="CalendarExtenderto" runat="server" TargetControlID="dtHOvr" Animated="true"
                                                                                            PopupButtonID="LinkButtonto" Format="dd/MMM/yyyy" BehaviorID="handOverDateExtender">
                                                                                        </asp:CalendarExtender>
                                                                                    </div>
                                                                                </div>

script
    function OpenDateChanged(sender, args) {
        var OpenDate = sender.get_selectedDate();

        var handOverDateExtender = $find("handOverDateExtender");
        var handOverDate = handOverDateExtender.get_selectedDate();
        if (handOverDate == null || handOverDate < OpenDate) {
            handOverDate = new Date(OpenDate.setDate(OpenDate.getDate() + 1));
            handOverDateExtender.set_selectedDate(handOverDate);
        }
    }