Set SelectedDate from Server of Picker in a dynamically added UserControl

This post has 4 replies

Not Ranked
Posts: 10
AndrewAdkins Posted: Tue Jun 16, 2009 @ 3:48 PM
I have two pickers and two calendars in a user control that is dynamically added to the page. For the most part all of the functionality is there (thanks to the numerous posts on this site on this topic). However, one particular postback updates the SelectedDate for both of the picker controls via server side code, this seems to have no effect (the pickers retain the same value they had when the page first loaded).
After reading a similar post on the topic I discoved that the hidden field referenced as: Request.Form(calendar.clientobjectid & "_selecteddates") always has the same value.

Is there some way from the server side to alter the picker control to refresh this value?

I have also tried clearing the selected date on the client side before performing the postback, but the Pickers stayed clear even after the postback had completed, the still did not pick up the values they were given on the server side.

Thanks
Top 10 Contributor
Posts: 6,424
hwan Posted: Wed Jun 17, 2009 @ 12:33 PM
Are you already setting all four items ie. both Pickers and both Calendars? The Pickers are typically linked to the Calendars on the client, so you'd need to manually set them on the server if you're changing the Calendar values there.
Not Ranked
Posts: 10
AndrewAdkins Posted: Wed Jun 17, 2009 @ 12:57 PM
I was only setting the values for the Picker controls. I tried setting all four but that did not have an effect. I have narrowed it down to the fact that the user control is dynamically added to the page. The update works fine if the user control is a static part of the page.
Not Ranked
Posts: 10
AndrewAdkins Posted: Thu Jun 18, 2009 @ 9:22 AM
I have some additional information. As it turns out the values update fine if the PostBack is genereated from a button click or simlar event. However, the event that is creating the postback that does not update the values is a ComponentArt grid item selected... Not sure if that helps to diagnose this problem, but the more clues the better.

Thanks again for any help you can provide.
Top 10 Contributor
Posts: 6,424
hwan Posted: Wed Jun 24, 2009 @ 11:36 AM
Are you certain that the Calendar update code is being executed, such as by placing breakpoint there in Debug mode in Visual Studio? You may also want to check that it's not be overwritten by other code later in the lifecycle.

If that doesn't help, can you post some of the code being used so that we can get an idea of what is happening?
Page 1 of 1 (5 items)