Simple page container - xamarin.forms

Is it possible to have a simple ContentPage or something similar that hosts another page without any of the frills that come with tab page or navigation page? I want this host page to be essentially invisible.
The idea is to pop up a login modal on the root page and then, when the user has logged in, switch the contents in the background so that when the login page is popped off, it reveals new content.

If you want the NavigationStack available so you can push & pop pages, you need to use NavigationPage. You have a couple of reasonable options though:
Reassign Application.Current.MainPage whenever you want a page transition. This won't create a page stack, but will show the new content when reassigned without animation. So rather than thinking about a login modal then popping it off, just set the current page to the login page, then on login, set the current page to the content you want the user to see.
Use a NavigationPage as the Application.Current.MainPage, but then call SetHasNavigationBar(page, false) to avoid the extra elements that come with NavigationPage. You may need to call NavigationPage.SetHasBackButton(page, false); for every page you push on the stack to avoid the back button.

Related

Create sign out button in master page in ASP.Net

I am trying to create a master page with a sign out button. And to clear session on sign out button, I need to wrap that button in a form tag. Pretty straight forward, right?
Problem is that the content page will have their own form tag as well. So, application crashes saying "page can have only one form".
Now, I need to figure out a way to have that sign out button make a server side call without using form tag. How can I achieve this?
As of now, I have two ideas in mind. First is to redirect to an intermediary log out page. Second is to wrap the whole master page in a form, so content page will never need a form tag. Is there a better way to acheive this?

Prism.Forms : How to dispose the page that has been navigated from?

[Xamarin.Forms]
I have a case where I am on the sign in page and after the user press sign in button I use the navigation service to go to the MainPage. The problem is that "LoginPage" is still active and receives and interacts with events, such as the login button would be pressed if I press "Enter" from the keyboard or the remove control .
So is there a way to get rid of the "LoginPage" so it does not listen to keyboard events (provided by default in Android) .
Otherwise , is there a way to dispose the "LoginPage" After I navigate from it ?
Navigating away from a view to another using Prism's INavigationService.NavigateAsync does not remove the page from the navigation stack. It simply pushes another view onto the stack. Therefore it will not be GC'd. You must remove the page from the navigation stack by either using an absolute URI when navigating, or to use XF's APIs to remove the page manually.

Maintain Scroll Position with response.redirect function

I have one main page in my asp.net website.
In that page i have used gridview with hyperlinkfield.
on click of any of hyperlink, application will redirecting to detailed page.
on coming back to main page i want to hold scroll position instead of i am getting top of page.
i have tried maintainscrollposition script but its not working.
i also have used master page.
i have used button on detailed page and onclick i have used response.redirect.
How can i maintain my scroll position in this scenario ?
Since you are leaving the page and coming back, you cannot store in data in javascript or the ViewState. This leaves you with two options:
Save the scroll position in a session variable. You will have to use a hidden field to send a javascript variable to the server to save it.
You could also use a cookie with an appropriate expiry time to remember the scroll position. Using a cookie allows for a pure javascript solution.
Using a cookie is a simpler and better option in my opinion.

Getting Lightbox to Appear over Referring Page

I am working in ASP.NET (framework 2.0) with Master Pages.
I have a page that requires registration and then the user gets kicked back to the referring page.
I need to figure out how to provide a success lightbox that appears over the referring page, not the registration page (the event is fired on form submit).
I have the inline stuff in the master page and the scripts and everything fires just fine but the form is refreshed with the new (referring) page and the DIV gets hidden again.
Is sessions the only way to go here? Is there a way of having one lightbox appearing from the master page regardless of what the sub-pages are doing?
Thanks.
There should be a successful registration event. Can you emit some javascript in that scenario that would cause a redirection to the referring page. You could pass a parameter which would indicate that a light box should show up. I don't think you can redirect directly from successful registration because I am guessing that some cookie would need to be set- which the framework should handle. I might be off, but that is where I would start. I would try and avoid Session if possible.

Get URL of link clicked inside frame/object

So, I have a page (page1.html) and then I have an iframe or object serving up some other page (page2.html) within that page... What I want/need is when the user clicks a link inside the iframe (page2.html) i need a way for page1.html to recognize that the iframe href has changed because the link is loaded into the iframe.
There is no onload event for the object/iframe element so i can't figure out when the user has clicked a link inside the IFRAME (page2.html)...
You have very little control over what happens in an iFrame. Essentially, once you load it, you have no power over it, and you can't see what happens in it. (You can still tell it to load something else.) If you want that sort of control, you should really be using AJAX, i.e. you should be loading new content into the document object model dynamically.
right click on the link and then click open in a new tab / new window, this will open the webpage in a new tab , then copy the url from the address bar of the browser.

Resources