Page_Load after Modal Popup - asp.net

I have a page with a user control which gets some data updated via a modal popup. Upon clicking "ok" on the modal popup - the new data is being written to the database - but the base page doesnt "reload" to show the updated data. How do I get that to happen?

1) Don't set the OKControlID property on the ModalPopupExtender.
2) In your Page_Load, set OkButton.OnClientClick = string.Format("$find('{0}').hide();", modalPopupExtender1.ClientID);
Explanation:
Setting the OkControlID stops the button from posting back. Instead, manually use javascript to hide the extender, which will allow the button to post the form.

You'll either have to update that control using ajax, or you could just do a Response.Redirect(assuming your modal is .net, or document.location if js) back to your page after your data has been updated.

Make sure the "Ok" button in your modal popup is causing a postback. If you want it to be ajax-enabled, make sure to put it inside of an update panel.

Related

Using ModalPopupExtender in ASP.NET Repeater

When using ModalPopupExtender inside a repeater, when the page loads, ALL of the popups appear without being called ( one for each item in the repeater) and then rapidly dissappear. With this, the popup works , but the problem is these popups being showed at the beginning. The popup is an OK/CANCEL popup, that triggers a postback when OK is clicked and does nothing when cancel is clicked. It is loaded on page load so that it exists when the user clicks on a linkbutton on the repeater. When the user clicks on the linkbutton, our intention was taht the popup appear directly without doing a postback, and this was achieved , just that small problem that random parade of popups at the beginning!thank you in advance!
I was not able to answer until now, sorry.
Turns out the HTML code and the CSS had conflicting codes and that made the popup appear!

Problem with Ajax control toolikt Modal Pop control

I have an ajax control toolkit modal popup on my page and in that modal popup i have a gridview on which user select some item through checkbox on each row of gridview. Whenever user check or uncheck on checkbox my modal popup automatically hide. I have set autopost property of checkbox set to true becuase im perporfing some calculation on each checkchanged event. what may be the problem
Your page is posting back because of the autopostback="true" on the checkbox, thus hiding the modal popup.
Look up 'ASP.Net Page Lifecycle' for further understandinf. It is important to know how this works.
I'm sure you'd also like to know how to solve this.
You could:
Set AutoWireUp=false on the page, but then you'd have to wire all events on the page manually. Since you aren't familiar with the Page Lifecycle, I'm not sure how successful you'd be.
Use a javascript-only modal popup.
Perhaps an UpdatePanel can be used.

Prevent Postback in array of linkbutton is created at dynamically

i have created Array of Linkbutton
and when user click on link button it will create an array of Radio Buttons
but it requires Postback all time so page load takes more time...
what is solution of it??
Use asp.net Ajax update panel.
Put link buttons and panel/view (or what ever control you are using ) update panel.
I am not sure if I am following a 100% but if you don't want to do a post back then your going to need to write some javascript(or use a framework like jquery) to generate radio buttons when the user clicks the link button(plus you probably don't want to use a link button then as it will try to always cause a postback or you will need to stop the post back from happening).

I want a popup with a cancel button. Is it a good idea to use an AJAX Popup control extender?

Please note this is a popup and NOT modal popup. The users do not want a modal popup.
Is it a good idea to use an Ajax Popup Control extender in the following circumstances;
I want to populate a textbox. When the user clicks on it, he sees a popup window.
In the popup window you can enter value of the field, or make a selection from a drop down list. When you have decided, you can either click on a submit button to commit your changes, or click on a cancel button to ignore your changes.
By experimenting I have found how to do this, apart from the cancel button.
How do I do this? Or should I try something else?
You might want to check out this jquery plugin
http://labs.abeautifulsite.net/projects/js/jquery/alerts/demo/
http://developer.yahoo.com/yui/examples/container/dialog-quickstart.html has a good example of what you are looking for

Is there a way to open another page using ModalPopup Extender?

I was wondering if there is way to open another page using a Modal Popup Extender?
and if there is can someone please the tell me how do i go about doing it ..
Thanx
Owais
You could probably put an iframe pointing to the page within the Modal Popup Extender, however that would be a bit of a hack. I would recommend putting whatever content on that page into a user control and then referencing that control from both the original page and the page with the modal popup.
Try using an HTML iframe as the target control of the extender. The iframe tag has a "src" attribute that should point to the page you want to show in the dialog.
You have to think about it w/o the illusion - fundamentally the modal popup is just a DIV. So the question is "can you display a different page in a div?". Iframe... or perhaps a webservice call.
you can use a user control and load it dynamically into the modal popup
Dim ctrl As Control
ctrl = Me.Page.LoadControl("~/control/cmsbar.ascx")
ctrl.id="ctrlx"
Placeholder1.Controls.Add(ctrl)
popup.Show()
note that the popup will have a placeholder to add the control to. you must give the user control an id so the viewstate can be loaded for the control . this code must be placed in the Page_Init event so when the user control is created for the second time it loads its view state

Resources