Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a method to load a gridview according to a value inside a Cookie.
Now its not loading. Please help me with this cookie

C#
Response.Cookies["selectedDateCookie"].Value = DatePicker.Text;
        Response.Cookies["selectedDateCookie"].Expires = DateTime.Now.AddMinutes(10);
        string selectedDate = Response.Cookies["selectedDateCookie"].Value;
        DataTable  dTable = new DataTable();
        systemBusinessLayer = new BusinessLayer();
        dTable = systemBusinessLayer.GetAllAppointmentsForToday(selectedDate);
        grvViewAppointments.DataSource = dTable;
        grvViewAppointments.DataBind();
Posted
Updated 8-Sep-11 4:51am
v2
Comments
Herman<T>.Instance 8-Sep-11 10:51am    
what's the error/exception?
Anele Ngqandu 8-Sep-11 11:03am    
I just saw that the DatePicker.Text is empty. and i dont know y because it appears in the screen to have the current date
Herman<T>.Instance 8-Sep-11 11:26am    
why you have not set the value in Session? Not everyone is allowed to have a cookie written
Anele Ngqandu 9-Sep-11 3:34am    
I have also tried that but the value form the DatePicker.Text is lost
Herman<T>.Instance 9-Sep-11 3:44am    
shouldn't you use DatePicker.SelectedDate?

1 solution

U can do one thing, first check where cookie is null or not using if condition, then assign cookie value to some variable,and then pass the variable as u have done in coding,
 
Share this answer
 
Comments
Anele Ngqandu 9-Sep-11 3:35am    
The thing is i need that value inside DatePicker.Text wich is lost for some reasons.

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