Click here to Skip to main content
15,885,244 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Handling sessions Pin
led mike1-Apr-08 4:56
led mike1-Apr-08 4:56 
Question[Message Deleted] Pin
ahlaj7731-Mar-08 4:43
ahlaj7731-Mar-08 4:43 
GeneralRe: How to go about creating a voting system Pin
led mike31-Mar-08 4:48
led mike31-Mar-08 4:48 
General[Message Deleted] Pin
ahlaj7731-Mar-08 4:59
ahlaj7731-Mar-08 4:59 
GeneralRe: How to go about creating a voting system Pin
led mike31-Mar-08 5:01
led mike31-Mar-08 5:01 
Question[Message Deleted] Pin
ahlaj7731-Mar-08 5:16
ahlaj7731-Mar-08 5:16 
GeneralRe: How to go about creating a voting system Pin
led mike31-Mar-08 5:38
led mike31-Mar-08 5:38 
GeneralCalender Chaos Pin
Reelix31-Mar-08 3:16
Reelix31-Mar-08 3:16 
I have some code I was (attempting) to optimise, and came across a weird problem...

I have a button, and 2 Calender Controls

Here's the code

<br />
protected void Button1_Click(object sender, EventArgs e)<br />
    {<br />
        string date = "2008/03/27 12:36:00 PM";<br />
<br />
        int year = Convert.ToInt32(date.Substring(0, 4));<br />
        int month = Convert.ToInt32(date.Substring(5, 2));<br />
        int day = Convert.ToInt32(date.Substring(8, 2));<br />
        int hour = Convert.ToInt32(date.Substring(11, 2));<br />
        int minute = Convert.ToInt32(date.Substring(14, 2));<br />
<br />
<br />
        //Compare the following 2...<br />
<br />
        DateTime dt1 = new DateTime(year, month, day);<br />
        Calendar1.SelectedDate = dt1;<br />
<br />
        DateTime dt2 = Convert.ToDateTime(date);<br />
        Calendar2.SelectedDate = dt2;<br />
    }<br />


Looks the same, correct?

That's what I thought...

The Problem - After the Button is clicked, the 1st Calender has it's date selected, and the second one doesn't...

Now, the thing is, if you change:

DateTime dt1 = new DateTime(year, month, day);

to

DateTime dt1 = new DateTime(year, month, day, hour, minute, 0);

then the first Calender "Breaks", and doesnt select the date...


Confused | :confused: Unsure | :~ Confused | :confused:


Any suggestions as to why?
GeneralRe: Calender Chaos Pin
Jesse Squire31-Mar-08 3:22
Jesse Squire31-Mar-08 3:22 
GeneralRe: Calender Chaos Pin
Reelix31-Mar-08 3:28
Reelix31-Mar-08 3:28 
GeneralRe: Calender Chaos Pin
Jesse Squire31-Mar-08 3:31
Jesse Squire31-Mar-08 3:31 
GeneralRe: Calender Chaos Pin
Reelix31-Mar-08 3:36
Reelix31-Mar-08 3:36 
GeneralRe: Calender Chaos Pin
Jesse Squire31-Mar-08 3:47
Jesse Squire31-Mar-08 3:47 
GeneralRe: Calender Chaos Pin
Reelix31-Mar-08 3:52
Reelix31-Mar-08 3:52 
GeneralRe: Calender Chaos Pin
Jesse Squire31-Mar-08 3:56
Jesse Squire31-Mar-08 3:56 
JokeRe: Calender Chaos Pin
Anurag Sharma - Backoffice31-Mar-08 5:18
Anurag Sharma - Backoffice31-Mar-08 5:18 
Generallast modified column Pin
docsoft31-Mar-08 1:36
docsoft31-Mar-08 1:36 
GeneralRe: last modified column Pin
Laddie31-Mar-08 2:13
Laddie31-Mar-08 2:13 
GeneralRe: last modified column Pin
docsoft31-Mar-08 2:23
docsoft31-Mar-08 2:23 
GeneralRe: last modified column Pin
Laddie31-Mar-08 2:49
Laddie31-Mar-08 2:49 
GeneralRe: last modified column Pin
farazsk1131-Mar-08 7:50
farazsk1131-Mar-08 7:50 
Questionbutton control issue. [modified] Pin
Pankaj Garg31-Mar-08 0:42
Pankaj Garg31-Mar-08 0:42 
GeneralRe: button control issue. Pin
Declan Bright31-Mar-08 1:29
Declan Bright31-Mar-08 1:29 
QuestionRe: button control issue. Pin
Pankaj Garg31-Mar-08 2:17
Pankaj Garg31-Mar-08 2:17 
GeneralRe: button control issue. Pin
Declan Bright31-Mar-08 2:25
Declan Bright31-Mar-08 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.