Select multiple dates in AJAX CalendarExtender in ASP.Net using C# and VB.Net

Last Reply 3 months ago By dharmendr

Posted 3 months ago

hello, 

i want to enable single and multiple date selection in ajax calenderextender 

please advice

Posted 3 months ago Modified on 3 months ago

Hi nauna,

This is not possible with ASP.Net AJAX CalendarExtender to select multiple dates.

If you want to select multiple date use multiDatesPicker plugin.

HTML

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.rawgit.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.css" />
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/pepper-grinder/jquery-ui.css" />
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.js"></script>
<script type="text/javascript">
    $(function () {
        $('[id*=txtMultiDatePicker]').multiDatesPicker();
    });
</script>
Date:
<asp:TextBox ID="txtMultiDatePicker" runat="server" />
<asp:Button Text="Save" runat="server" OnClick="Save" />

Code

C#

protected void Save(object sender, EventArgs e)
{
    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('Selected Dates are : " + txtMultiDatePicker.Text + "')", true);
}

VB.Net

Protected Sub Save(sender As Object, e As System.EventArgs)
    ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "alert('Selected Dates are : " + txtMultiDatePicker.Text + "')", True)
End Sub

Screenshot