Wednesday, 15 November 2017

Date range in bootstrap date picker control using jquery



//////HTML

<asp:TextBox class="form-control" runat="server" AutoComplete="off" ClientIDMode="Static"

                                                        placeholder="dd/mm/yyyy" ID="Startdate");" />

//////Jquery
1.
$(document).ready(function () {
            setdatesRanges();
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(setdatesRanges);

        });
2.
function setdatesRanges() {
            Date_Range('Startdate', 'EndDate', true);

        }
3.
function Date_Range(tFrID, tToID, IsStartDate) {
    var setMinDate = "";
    if (IsStartDate == true) {
        setMinDate = 'now';
    }
    $('#' + tFrID + ',#' + tToID + '').datepicker({
        format: "dd/mm/yyyy",
        useCurrent: false,
        autoclose: true,
        startDate: setMinDate
    });
    $("#Startdate").datepicker().on('changeDate', function (e) {
        var minDate = new Date(e.date);
        $('#' + tToID).datepicker('setStartDate', minDate);
        $('#' + tToID).val($(this).val());
    });

}

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...