Force a postback when the back button is pressed - asp.net

I have a webpage with a combo box on the page which is loaded with it's data on the Page_Load event of the page.
From that page I have a link which opens another page (within the same IE window) which allows the user to add/remove items that should appear in the combo.
The problem I have is when the user adds a new item to the combo I need this item to appear in the list on the parent page. However when I click the back button on the browser the Page_Load event on the parent page doesn't fire and the new item isn't loaded into the combo.
Want is the best way to handle this?
I'm using ASP.NET 4.0 and IE9.
Thanks in advance.

You could use javascript and call window.parent.location.refresh() on your new window to force a reload.
Best regards.

Related

how to show popup with user control when clicking a button in webform?

i want to create a popup window when clicking on a button in webform and after that i want to show a user control in that popup.how to do in asp.net?
i tried with some jquery methods but nothing happens when clicking button?
i want to create a popup window when clicking on a button in webform and after that i want to show a user control in that popup.how to do in asp.net?
i tried with some jquery methods but nothing happens when clicking button?
Think about using an IFrame to achieve this, from the sounds of what you are talking an IFrame would suffice and provided the needed functionality.
<iframe src="YOUR PAGE HERE"></iframe>
There's a lot more you can do with it, these are just the tags to get you going.

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!

How to save the listitems being added at client side when click the brower's back button?

I have two ListBoxes, left one and right one, and two Buttons in between Add and Remove. I wrote javascript function for Add/Remove to add selected items from left ListBox to the right ListBox. After submit the page, I click the Back Button in the browser, the items in the right ListBox are gone. I think the reason is probably because those items were added at the client side, server didn't know. It there anyway I could save those items so that when I click the Back button, they are still inad the ListBox?
I don't want to make the Add/Remove do a postback, since loading the page takes a while. I tried to put them in a updatepanel, but not working.
Update: I put the right ListBox in an UpdatePanel, and make the Add/Remove button PostBackTrigger, it worked. But this way caused a whole page postback? Why do I need UpdatePanel then? If I make the Add/Remove AsyncPostBackTrigger, it only caused partially postback, but when I clicked the Back button, my selection was gone. Any suggestion?
As per my knowledge, you cannot handle the browser "Back" button. You can disable the Back button instead in order to avoid the situation.
Could the jQuery BBQ: Back Button & Query Library solve your problem perhaps?

Page_Load after Modal Popup

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.

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).

Resources