Reputation: 10037
I have a GridView
control where if the user click on the auto-generated edit button. A window will pop up using modal pop-up extender with a drop down list for user to select. The problem is the SelectedIndexChanged
event will not fire if AutoPostBack
is set to false.
But if I set the AutoPostBack
to true the pop-up will go away without firing the SelectedIndexChanged
event.
Is it possible to have a control with AutoPostBack
set to true inside the modal pop-up?
Upvotes: 0
Views: 10705
Reputation: 538
Please put below code on drop down server side change event
modalpopup.show(); updatepanel.update();
where modalpopup is "ID" of modalpopupextender and updatepanel is "ID" of updatepanel
Upvotes: 1
Reputation: 1
You can use an UpdatePanel
to resolve this problem. Wrap the DropDownList
and any other controls that might give similar issue inside of an UpdatePanel
, inside of the pop-up control. This will allow the pop-up to continue showing, while executing your postback code at the right time.
Upvotes: 0
Reputation: 183
The problem is the selectedindexchange event will not fire if autopostback is set to false...
I'm not sure that statement is strictly true. Isn't it a case that if autopostback is false, the SelectedIndexChange event fires during the next postback? So if you change the index, then click a Submit button, that's when the index change event is fired.
This isn't much good if you need server code to run to respond to the index change while the popup is still showing, but otherwise, you can still respond to the index change.
If you need to change something in the popup in response to the index change, you can always use client-side javascript.
Upvotes: 0