Click here to Skip to main content
15,882,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can any one help me to pick date time in ASP.NET?
Updated 19-Oct-10 19:57pm
Mohd Wasif 20-Oct-10 1:12am    
Just Clarify ,Which Control u r using and on which application(desktop or Web)


.aspx code:
<asp:Calendar ID="calSearch" runat="server" Width="159" Height="136" BorderColor="#c59e9e"
        BorderStyle="Solid" BackColor="#ffffff" BorderWidth="2px" NextPrevFormat="ShortMonth"
        DayNameFormat="FirstLetter" SelectionMode="Day" Font-Size="7pt">
        <TodayDayStyle ForeColor="White" BackColor="#7D4D41" />
        <SelectedDayStyle ForeColor="White" BackColor="#7D4D41" />
        <TitleStyle BackColor="#ffffff" BorderColor="Black" Font-Bold="True" />
        <WeekendDayStyle BackColor="#F4F4ED" />
        <DayHeaderStyle BackColor="#D8CAC6" Font-Bold="True" Font-Size="7pt" ForeColor="#303030" />
        <OtherMonthDayStyle ForeColor="#155684" />

C# code:
calSearch.SelectedDate.ToString("MMMM, dd yyyy");
Share this answer
Ankur\m/ 20-Oct-10 2:11am    
Use PRE tags (code block) to surround your code snippet.
shakil0304003 20-Oct-10 9:53am    
I know that but when i write html content in the PRE tags then the html can not come currently. can you please tell me how can i write html content in the PRE tags correctly. You can mail me, about this & it will be helpful to me.
DateTime date1 = Convert.ToDateTime(dateTimePicker1.Text);

if you are using desktop the use it.

If you are using web application use calender Extender.
Share this answer
There a quite a few thrid party date controls available.
Trying searching on the internet.

For a few, see[^][^]
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