Hi all
I have developed a custom control that extends ListBox. The idea is that the control 'remembers' modifications to its elements which occurred client-side, e.g. as a result of an AJAX request.
The way it works is that the control also renders a hidden input, and the result of the AJAX request is stored in the hidden input. This is posted back, and the control's LoadPostData() method looks for the hidden input, and if the hidden input has data, creates the ListItem collection from it.
This works perfectly so long as the user has made a selection from the list box. If they have not, the LoadPostData() method doesn't get called, and consequently the new ListItem collection is not created. (I've established this using the debugger.)
I assume that the LoadPostData method is only called if the POST data collection includes data corresponding to the control's UniqueID (i.e. 'name' attribute in HTML). If the user hasn't made a selection from the list box, nothing is included in the post data for the list box's UniqueID and LoadPostData() isn't called. Is that correct?
Can anyone suggest how I can ensure that my custom ListBox's LoadPostData() method is called every postback regardless of whether the user has made a selection?
Thanks in advance - I'm really stuck with this one.
David