This topic is locked
[SOLVED]

 Back to home and/or previous page?

3/10/2016 9:54:44 AM
ASPRunner.NET General questions
Pete K author

It seems every page generated has a button, "Back to menu". I don't like the blank menu page and would prefer to take the user back to either the home (landing) page or to the previous page. Is there a way to override this behavior, application-wide?

jadachDevClub member 3/10/2016

None of my pages on any app have back to menu. Can you provide a screenshot?

Pete K author 3/10/2016



None of my pages on any app have back to menu. Can you provide a screenshot?


I think I've discovered the reason for it. Two of my view pages are displaying them where where normally you would see "back to list". (Which, by the way, doesn't always make sense in every context either.) But these two particular view pages are based on queries that I constructed just for the purpose of displaying selected information and neither has a list page.
The problem is compounded by the fact that the layout I selected does not display the menu on certain pages, view being one of them. So the user is left with no menu and no hint of context. Guess I need to go back and work on the layout.
Lots to learn!

jadachDevClub member 3/11/2016

I just duplicated what you are referring to. Yes, now I see back to the menu and no other options to get anywhere.
I've never displayed data this way in ASPR. I guess I've always accessed the view page from the list page, or if I wanted to show one record, I would still use the list page.
What about creating custom buttons to give the users options from the view page?

Pete K author 3/11/2016



What about creating custom buttons to give the users options from the view page?


Yeah, that's probably the direction I will do. I did a lot of experimenting last night with making radical changes to the html in some pages and am getting a feel for it. It's really nice knowing you can revert back to previous versions or just hit reset if you really hose it. I would have killed for that feature in ISD.

T
Tim 3/17/2016

Hey guys, I just wanted to confirm that if you don't have a list page selected for a table, then you do see the "Back to menu" button instead of the "Back to list" button. I sometimes use an add or edit page with no list page, and then redirect the user somewhere after the add/update. In this case there is a "Back to menu" button.
You can control where the "Back to list" and/or the "Back to menu" buttons take the user when clicked by adding the following code to the "Before display" event:
xt.assign("backbutton_attrs","onclick=\"window.location.href='WWW.GOOGLE.COM'\""'>WWW.GOOGLE.COM'\"");
Obviously change the WWW.GOOGLE.COM to whatever address you want. The other thing you'd probably want to do is change the label of the button, which you can do in HTML mode of the visual editor.
One last point. I think you can add the menu to the view page by selecting the "with_menu" style in the style editor. Have a look at the bottom of this page:
http://xlinesoft.com/asprunnernet/docs/add_edit_view_page_layouts.htm
Good luck!

Tim

jadachDevClub member 3/17/2016

Thanks for xt.assign("backbutton_attrs","onclick=\"window.location.href='WWW.GOOGLE.COM'\"";);

It could come in handy!

Sergey Kornilov admin 3/18/2016

+1 to what Tim suggests.
One more thing. Sometimes it is easier just to remove all standard buttons and add your own button with different wording and just make it redirect to any page. Sample code for ClientBefore event:

location.href="http://cnn.com";;
Pete K author 3/21/2016

Good information. Thanks all!
So now I have labeled "Back to Menu" as simply "<< Back" and have used Tim's suggestion to redirect to the previous page by placing this following in the "Before display" event:

xt.assign("backbutton_attrs","onclick='window.history.back()'");


If I choose, I can make it redirect to home by inserting the URL of the home page, or simply the site root.
Perfect.