How to set calendar in textbox in C#

As pervious we have seen How to set calendar intextbox in using jquery but if want to called calendar pure by control with c# then you can use this .Both are good and no problem with both code so you  can use with you convenient .

Source Code:-

        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:ImageButton ID="ImageButton1" runat="server" Height="17px"
            ImageUrl="~/image/calender.jpg" onclick="ImageButton1_Click" Width="21px" />
<asp:Calendar ID="Calendar1" runat="server"
            onselectionchanged="Calendar1_SelectionChanged" Visible="False">

C# Code:-

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        Calendar1.Visible = true;
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        TextBox1.Text = Calendar1.SelectedDate.ToShortDateString();
        Calendar1.Visible = false;

How to set calendar in textbox in C# How to set calendar in textbox in C# Reviewed by NEERAJ SRIVASTAVA on 7:38:00 PM Rating: 5


Powered by Blogger.