E
Eran Amitai
I have a dropdownlist control that doesn't automatically post back. When
certain entries are selected, however, I need to go to the server. I
implemented client script that catches the SelectChanged event, checks the
value selected, and if it is one of two special values, explicitly posts
back to the server. So far so good.
My problem is that one of the two special entries is the first entry,
initially selected when the page is displayed. On the client side, if you
drop down the list and reselect the same entry no event is generated. If,
however, the user selects a different entry and then drops it down again and
selects back the first entry, a client event is created, which I happily
trap and post back to the server.
Alas, on the server side no event is generated because the droplist control
thinks the value hasn't changed. Since it is not aware of the transition
that occured on the client side it thinks nothing changed. I do not get an
opportunity to process my special value.
Is there any way I can force the droplist control to fire an event? Can I
tamper with the view state just after it's loaded but before the control's
LoadPostData function is called so as to fool the list control? (I saw the
control's ViewState property is protected so I can't access it.)
Obviously I can implement a custom control that derives from the
dropdownlist control, but that seems a bit extreme to me. I'm looking for an
easier solution.
Any advice would be appreciated. Thanks.
certain entries are selected, however, I need to go to the server. I
implemented client script that catches the SelectChanged event, checks the
value selected, and if it is one of two special values, explicitly posts
back to the server. So far so good.
My problem is that one of the two special entries is the first entry,
initially selected when the page is displayed. On the client side, if you
drop down the list and reselect the same entry no event is generated. If,
however, the user selects a different entry and then drops it down again and
selects back the first entry, a client event is created, which I happily
trap and post back to the server.
Alas, on the server side no event is generated because the droplist control
thinks the value hasn't changed. Since it is not aware of the transition
that occured on the client side it thinks nothing changed. I do not get an
opportunity to process my special value.
Is there any way I can force the droplist control to fire an event? Can I
tamper with the view state just after it's loaded but before the control's
LoadPostData function is called so as to fool the list control? (I saw the
control's ViewState property is protected so I can't access it.)
Obviously I can implement a custom control that derives from the
dropdownlist control, but that seems a bit extreme to me. I'm looking for an
easier solution.
Any advice would be appreciated. Thanks.