I used asp wizard with updatepanel and google map (it works great).
Wizard has 3 steps - all work's great, but when i click browser back button steps changed and i lose all previous information. When i click wizard previouse button - i can see my information.
i try this:
http://dotnetslackers.com/articles/ajax/HandlingTheBackButtonFromServerCode.aspx
but ScriptManager1.IsInAsyncPostBack always is false, and a hasn't hisotry - second problem: i want to get all information in this step
Maybe some other solutions??
It seems you want to put a square peg in a round hole.
If you want to navigate the wizard, use the wizard previous, next and finish buttons.
The browser back button is to move to another page, which is not a typical ajax application workflow and most definitely not the proper way to navigate a wizard control.
Related
I thought this would be a trivial feature, but I have lost a fair bit of hair trying to figure it out. I have a jquery mobile web page with a select menu. Users click an item in the drop down list, then later click on a link and navigate to another page. Users then click the back button. The desired result is that the selected item remains selected. Right now, the selection is lost, and it defaults to the first element in the list again.
Things I've tried:
1) Use an asp.net dropdownlist with autopostback. This preserves the selected option, but then I get a page flicker because the entire page is posted back.
2) Wrap above asp.net dropdownlist in an updatepanel. This preserves, doesn't flicker, but it wipes out the jquery mobile styling. Also tried some suggested workarounds with firing a jquery create event, but couldn't get anything working.
3) Write cookies on the select change event in javascript, and read them in the asp page_load event. However, page_load is not called when the back button is clicked, so this had no effect.
4) Tried creating a jquery ajax request to a web page method, but the method must be static and therefore I can't get it to modify the page.
Any other ideas? Is it just me or should this indeed be a problem that's been solved a million times?
As an FYI, I am a newbie at web programming, so please spell it out if you have an answer :) (come from a c++/database background).
Thanks!
Turns out even the date scroller could not survive a back button in some cases. For example if the user navigates to another site, and then uses the back button to come back to my jquery mobile site, all my javascript dom manipulations are lost. The solution is non-trivial. I store everything I need to maintain state of a page using html 5 local storage. On the jqm show page event, I detect if all my global variables have been wiped clean, and if so, reload state from local storage. Works perfectly, but it is quite an implementation task. And of course, if local storage is not supported by underlying browser, it all falls to pieces.
I am working on an application, where a user can start filling a (multipage)form and press back button to navigate to previous screen and continue button to navigate to next screen.
Currently, the page was implemented using the browser's back capability. This causes circular reference
The Scenario is
Navigate from page 2 to page 3 click back button on page 3
User is now in page 2 and clickint back button pn page 2 will take it to page 3 (because of browser's history has page 3.)
This has to be achieved by using session? How can this be implemented correctly? What options does asp.net provide?
Have a look at the Wizard control - it's designed for your sort of scenario where you have multiple pages and you want to go back and forth between them. And you can combine it with AJAX to avoid postbacks :-) ScottGu has a piece on it here.
You can save all steps in session variable, for example of type Queue. When you need return two steps back, simple, two times dequeue and go to uri.
I am trying to make a registration wizard that contains about 6 steps.
I have moved away from using the standard asp.net registration wizard as I want more control over the look and feel.
I am using the easyslider plugin as I want a back and forward button that allows the users to click through the steps and be able to go back and forwards.
So everything was going well until a added an asp.net button into the plug. When I click it the page postback isnt happening, Does the plugin stop the ability to use asp.net controls inside? Is there something else I need to do to enable the click event to fire when using this plugin?
Any advise would be great!
Thank you
Make sure your button is registered properly (eg : with a runat="server") in the aspx file.
Did you try to move that button outside of your wizard ? I never used easyslider but I guess, like most sliders, it "just" hides or shows partial part of the page so I see nothing that could prevent a post back from happening.
i need to implement a back button for my asp.net website.I am able to use the javascript method to acheive my requirement.But using this method sometimes I need to click on the back button multiple number times to go back to the previous page.It may be because we are using jquery tabs in our website.To focus on a particular tab,other than the 1st tab on page load I am using Page.ClientScript.RegisterStartupScript(....).So I am unable to take the user back to the previous page with just one click.
I also tried with asp.net-C# methods mentioned in the following link.
http://www.dotnetcurry.com/ShowArticle.aspx?ID=89
I am able to go back to the previous page, but its state is being lost.Could someone please help me in acheiveing my requirement?
Details:
I have page1.aspx,page2.aspx(which contains jquery tabs view/edit).
In the page1.aspx there are 2 buttons(View,Edit).If I click on view button it takes me to page2.aspx View tab(1st tab) and if I click on the edit button it has to take me to page2.aspx with Edit tab loaded.both View/Edit tabs contain back button.
Also from the View tab I can navigate to the Edit tab,by clicking on another Edit button present in it.
Thanks.
The methods you have covered in your question are essentially what is available to you.
You can either
1. Provide a link that uses javascript to make the client go back a page.
2. Provide a link that posts back to the server that redirects you back a page.
I am not sure why the jquery in your webform as described in your question is causing you to click more that once to go back. If you know that it will always take 2 clicks to go back you could try this method:
javascript: window.history.go(-2)
When you are using the postback/redirect method you will always be using a http GET method to retrieve the page you are returning too. If you want to maintain state you will have to do this manually i.e. save the values when leaving the page somewhere, like session or a temporary database, and when returning to the page, during the page load, check to see if the user has these values saved and pre-populate them.
I've done something similar (with automatic redirections though) and I had to keep track of the number of pages to go back in my ViewState (or Session if you're jumping from page to page):
code-behind
public void Page_Load()
{
Session["pagesToGoBack"] = ((int)Session["pagesToGoBack"])++;
}
mark-up:
<input type="button" value="Back" onclick='javascript:history.go(<%= Session["pagesToGoBack"] %>);' />
Be careful to reset the session variable when needed
Made me feel a bit dirty but it worked :)
What would be the easiest way to re-order existing page events according to the ASP.NET Page LifeCycle?
I'm trying to make my events more readable and maybe make it easy to scroll into a sequentially near event.
If there's no easy way, is there a non-mouse way to quickly switch to a page event without having to type the actual event in incremental search?
The only thing I can think of is using the code window navigator. To not use the mouse you can hit Ctrl+F2, then hit tab to tab to the method drop down, and you can use the arrows, including hitting a letter to move in the list and hit enter to select.