calendar reset to default values

Hi all,

I had two calendar control namely calFrom and calTo and had used the Selection_Changed event to capture the selected from date and to date. But I was puzzled that after I leave the Selection_Changed event, the from date and to date will reset to default value.

Can anyone please help

My code is as follow:

public partial class EOL : System.Web.UI.Page

{

DateTime fromDate;

DateTime toDate;

.........................

public void calFrom_SelectionChanged(object sender, EventArgs e)

{

fromDate = calFrom.SelectedDate;

}

public void calTo_SelectionChanged(object sender, EventArgs e)

{

toDate = calTo.SelectedDate;

}



Answer this question

calendar reset to default values

  • BerW

    Hi there,

    Is this ASP .Net web form ! In web forms we can not save any value to our variables.
    The life time of our variables is only in server side process period. When the page send
    back to the client every variables that we create will be reset.

    So, you can save your required values in something like Session, ViewState or something
    like these.

    ________________________________________
    May the God blessings be.

    LotraSoft Ltd.



  • calendar reset to default values