The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
SalesLogix DateTimePicker
Posted: 01 Oct 08 10:27 AM
|
Hi all
Anyone tried to use the datetimepicker and have keep setting back to the current date after every postback?
My other controls keep state but this slx datetime picker resets to the current date.
I have set EnableViewState to true. I am doing an auto postback on these date pickers.
Might just end up accessing viewstate and updating the date picker when the page posts back.
Any suggestions?
Thanks
Tony |
|
|
| |
|
Re: SalesLogix DateTimePicker
Posted: 02 Oct 08 3:16 AM
|
Thanks for the suggestion.
My problem is that the user changes the date in the picker causing the form to postback but instead of the date time picker holding the date that has been selected it resets back to the current date (I want it to keep the selected date). This works fine with the other ASP controls but not the SLX datetimepicker control. |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 03 Oct 08 4:58 AM
|
Is the datepicker properly bound? It should keep its value if its bound - Ive never seen a datapicker not keep its date before... |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 03 Oct 08 4:58 AM
|
Is the datepicker properly bound? It should keep its value if its bound - Ive never seen a datepicker not keep its date before... |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 03 Oct 08 5:07 AM
|
That could explain it. I dont have it bound to anything as I am just using so that users can select dates rather than let them free type dates.
|
|
|
| |
|
Re: SalesLogix DateTimePicker
Posted: 06 Oct 08 3:15 PM
|
You'll either have to bind the controls, or if that isn't possible set the value in a LoadAction with repaint event = true. You'll likely need to persist the selected value between refreshes/postbacks. You can persist the value in the state of the WorkItem for the page.
this.PageWorkItem.State["SelectedDate"] = dteMyDateTimePicker.DateTimeValue;
-Ryan |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 07 Oct 08 4:21 AM
|
I am still confused about this one. I have bound at least 50 datepicker controls and never seen this. Is it bound to a date field?? Are you doing anything on the postback, as you have set the autopostback to true. Do you really need a postback? Are there any loadactions or any code that runs when you postback to set the entity value that the datepicker is bound to to a different date? |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 07 Oct 08 6:06 AM
|
I'm still confused too
I haven't got it bound to any date fields. It is in a custom smart part and is being used so that a user can select a date which is then used in a filter. I set the date to YTD when the page loads and this works fine. I have set autopostback to false now to see what happens and once I do postback the page the date is set to current date again. I have got anything in my code that does this. The state of my other controls is held without issue.
All I do when when the page loads is use the date value of the datepicker to filter the results of my History data. This does actually work with the correct dates but somewhere the date gets set back to current date once the page finishes loading. |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 07 Oct 08 6:23 AM
|
Originally posted by Tony Joanes
I'm still confused too
I haven't got it bound to any date fields. It is in a custom smart part and is being used so that a user can select a date which is then used in a filter. I set the date to YTD when the page loads and this works fine. I have set autopostback to false now to see what happens and once I do postback the page the date is set to current date again. I have got anything in my code that does this. The state of my other controls is held without issue.
All I do when when the page loads is use the date value of the datepicker to filter the results of my History data. This does actually work with the correct dates but somewhere the date gets set back to current date once the page finishes loading. |
|
Ah I understand what you are trying to do now!! Never had to use a datepicker control in this way before so it may well be a behaviour of the SLX Datepicker control to revert to todays date. I would set the current value into state on the autopostback/change event of the datepicker (as per Ryans example), then further on in the page lifecycle (Page_PreRender should do) set the value of the datepicker control to the value from state. In the PreRender event check if state is empty, if so set it to blank or todays date, whatever behaviour you need...
protected void Page_PreRender() { // }
Thanks, Nick |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 07 Oct 08 6:49 AM
|
Even when I use ViewState I cannot set the datapicker.
I have stepped through the code and watched the values be set for the date picker only to see the webpage set the date back to the current datetime.
I even tried putting a button on the page to set the date but it stays at the current date.
Time for some textboxes!
I think SLX behaviour is doing something that I can't control. |
|
|
|
Re: SalesLogix DateTimePicker
Posted: 27 Nov 08 4:21 PM
|
I'm having the same problem...
I used a datetimepicker from saleslogix because i made a Dashboard for web, cause 7.2 don't have dashboard...
I can set te value until i change the value of the datetimepicker control... from that moment the control always will set itself back to today's date.
The control is not binded to anything... only for control.
I'm guessing i need to call the picker in a custom way to set a textbox? |
|
|
|