I follow the example in Atlas: Creating a Confirmation Using the ModalPopup Extender to make a postback when the OkButton in a ModalPopup is clicked (it uses the ModalPopupExtender that comes in ASP.NET Ajax Control Toolkit), but as I can see, the Sys.WebForms.PostBackAction() is no longer present in ASP.NET AJAX (the example is for Atlas). When I run it the "Microsoft JScript runtime error: Object expected" error message raises, in the line in javascript where I create the PostBackAction. How can I make this works in ASP.NET AJAX, or maybe, there's another way to do it? Thanks
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- Jquery Mobile: Getting a cancelled Postback that
- GetScriptReferences does not get called
- dynamically filled DropDownList does not retain va
- detect ajax request by jquery
相关文章
- After postback my JavaScript function doesn't
- How can I send int array from ajax to c# mvc?
- Submit Ajax.BeginForm via ActionLink
- ASP.NET MVC jQuery autocomplete with url.action he
- ASP.Net MVC 3.0 Ajax.ActionLink Onbegin Function t
- Animated gif freezes in UpdateProgress in IE8
- How to check file size of each file before uploadi
- Refresh of GridView after UpdateMethod in UpdatePa
Maybe just adding a server side OnClick event to the button? This should post back the whole form. Or you could get the main form from html ($find('myFormName') or something) and do a .submit() on it.
You can place an in-visible button in the panel and set it as OkButton. Add your actual button in the panel and add its OnClick event handler. See code below:
This is the solution I have been looking for. Great post. Incidentally, it is not neccessary to create the mock OK button. Just don't include the optional OKbutton prameter in the Modal Popup Extension definition.
Have you thought about using the ConfirmButtonExtender? You get the modal "bling" through the extender, and you'll have the PostBack processing you need.
You wire the button click event as normal for processing, but the Confirm extender will "intercept" the processing and allow things to continue if the user confirms the action.
Server side events do work with the ModalPopupExtender. What you need to do is to create a button with a display style set to none. Then set the TargetControlID property of the ModalPopupExtender to the hidden button ID.
In the OnClick handler show the modal:
In the handler for the control that will close the modal (usually a button) hide the modal:
I'm able to successfully use this method for posting back to the server in order to populate controls in my modal with info from a database during the postback. Works like a champ.
If I remember the ModalPopupExtender correctly, it has an OKControlID that you set as your button ID.
Could you not just assign your button on "onclick" clientside handler that calls a postback?
For example, something like:
EDIT: It looks like another potential solution here.