Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi!
i have asp:calander, textbox, and a button.
what i want is that when user enters january in the text box and click on button the calander should show the month of january.
ASP.NET
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<asp:Calendar runat="server" ID="eventsCal"></asp:Calendar>

Code behind
C#
protected void Button1_Click(object sender, EventArgs e)
    {
       
    }


please somebody tell me how to do it.
thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 17-Sep-14 14:39pm    
What is "asp:calander"? If you write something like that in code, build won't understand what you mean. :-)
—SA
saifullahiit 17-Sep-14 15:18pm    
if you check the code which i have given you will get my point what do i mean by asp:calander.
BDW its a asp.net control
Sergey Alexandrovich Kryukov 17-Sep-14 16:00pm    
Sure. I suggest you modify the question by using "Improve question" above (in 3 places) and spell it correctly from now on.
Good luck.
—SA

1 solution

Hi,
You can try the following :-

string month = "";
if (txttest.Text == "January")
month = "01";

calendartest.TodaysDate = Convert.ToDateTime("01/"+month+"/2014 00:00:00");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900