Please be assume that I have already login.
I have two pages. PickupList.aspx. There has a button named as "New".
When I click New button page url changed as PickupJobForm.aspx?mode=new
But loading time is not finish and form not appear.
After logout the application. And I copy and paste this url PickupJobForm.aspx?mode=new. And I press enter key from keyboard. Login form appears. After I logIn ready, I can see the create job web form.
What is the differences?
One more info is that our client computer is window 10. And we are using the Trend Micro Apex One.
protected void rbtnNew_OnClick(object sender, EventArgs e)
{
Response.Redirect("~/PickupJobForm.aspx?mode=new", false);
}
Related
I have a home page or landing page in my windows phone c# based app where user enters login details and upon successful login user is redirected to page2 . Here the user will see a list box with few items . Upon selecting an item from this list box a new page called "Threadx" opens.(where x is the each page that opens upon clicking the x item in the list box)
While user is on this Thread page "Threadx" he may receive the toast notifications and the thread gets updated with new replies or answers on that thread.
But When user clicks on back button the "ThreadX" page doesn't get closed and instead it goes to its previous state where it has less number of messages , and so on until the app gets closed.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Back)
{
return;
}
}
I would like to know if this "Threadx" page can be closed upon clicking back button without affecting other "Threadx+1","Threadx+2"..."Threadx+n" pages.
Any help would be really appreciated.
Normally windows keeps the pages on it's stack when you leave a page and navigate to another page. If you want to navigate to the previous page on pressing the Back Button you can do following things:
Add following line to OnNavigatedTo method:
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
Add definition for HardwareButtons_BackPressed method:
private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
e.Handled = true;
if (Frame.CanGoBack)
Frame.GoBack();
}
Don't forget to add Windows.Phone.UI.Input to the namespace list.
The other way I got it worked was using the below code in the onnavigateto method in my "thread" page and it worked for me. Let me know if there is an elegant way of doing it or better way of doing it .
if (e.NavigationMode == NavigationMode.Back)
{
NavigationService.Navigate(new Uri("/View/Page2.xaml", UriKind.Relative));
}
I can open the link in my standard browser with this code:
public void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
//cancel the current event
e.Cancel = true;
//this opens the URL in the user's default browser
Process.Start(e.Url.ToString());
}
But the problem is that IE only should be opened when a link on the webbrowser is clicked. When using this code IE also opens when I change the documenttext.
My suggestion would be to take a different approach. At the point in time immediately after the initial page has loaded in the WebBrowser control (Navigated event), you can use the webBrowser1.Document property to retrieve an HtmlDocument instance.
From this you should be able to find your link by using, for example,
http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.getelementbyid(v=vs.110).aspx
Then you can add an event handler to detect when this link is clicked, and in this handler, run your code to start the IE process.
I am working on ASPx Web Forms Page and have problem with printing page.
I have button 'Print' which calls event (print method):
private void MenuPrint_ItemClick(object sender, DevExpress.Web.ASPxMenu.MenuItemEventArgs e)
{
Response.RedirectOn("Print.aspx", "_blank", "menubar=0,scrollbars=1,width=780,height=900,top=10");
}
after I press 'Print' button it opens new window 'Print.aspx' and this is which is on this Page:
protected void Page_Init(object sender, EventArgs e)
{
LoadData(); // generate print document
Response.Write("<script language=javascript>window.print();</script>");
}
and now it's the problem:
window.print(); will open google chrome printing menu, which block old window (that window where is 'Print' button.
When I close Print.aspx by clicking [X] List.aspx windows will be still blocked. When I press 'Anuluj' - which means Cancel and then press [X] List.aspx won't be blocked. Eveything will be fine.
I make some research and figure out that there is no more options to print document, also I can't handle 'Cancel printing' button.
Question is how to avoid that block, maybe I should use something other instead RedirectOn?
This seems to be a bug of Chrome 34 - is this the Chrome version you are using?
There is a similar question open here: Javascript window.print() in chrome, closing new window or tab instead of cancelling print leaves javascript blocked in parent window.
No solution so far though.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
detect back button click in browser
I have two pages, Page1 and Page2. When moving from Page1 to Page2 by clicking a link, I tend to store the conditions required to restore the state of Page1 on clicking browser back button when on Page2.
I am using the below function to clear the cache,
protected override void OnInit(EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.MinValue);
base.OnInit(e);
}
so that I can reload the page based on stored conditions in the cookie. But the issue is how to identify if I have pressed the browser back button or the menu link to come to Page1.
Update:
i just landed on this link detect back button click in browser but it doesn't work for me
Please explain your problem, not your solution. Because you set the cacheability of your page to none, the browser will simply re-issue an unconditional request for the page. This is no different than clicking a link to that page and will not be detectable.
If your problem is that you don't know how to set form data when someone revisits a page, you could use a session like this (psuedo):
if (!String.IsNullOrEmpty(Session["Username"]))
{
UsernameTextbox.Text = Session["Username"];
}
If you want to show a clear form when the link to that page is clicked, you could set a query parameter like reset=true, which will clear the session data and show a blank form.
I have the below code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//do something
}
else
{
// do something else
}
}
protected void Button1_Click(object sender, EventArgs e)
{
//do something
}
}
The point is that a post back happens if I press F5/refresh button or a button click. How will I prevent the code from doing any action if F5/refresh button is clicked?
I have checked Detect F5 being pressed and Refresh but the solution of mine will be different as I need to do this in C# code.
Thanks
You are trying to capture something on the client - so it must be client side script (as discussed in the link).
It's not a postback in ASP.Net terms - your page is simply being requested again (GET). You cannot stop this - its just like going to some other page on your web site and clicking back through some navigation.
If you are saying you want to prevent some type of server side code you have from being run (more than x times) then you can think about sessions or cookies and read them in before you run whatever process. A simplistic sample:
visit page 1 - set session or cookie that identifies page 1 process was run
visit page 2 - set session or cookie that identifies page 2 process was run
return to page 1 - check for existence of session or cookie variable, and if exists, don't run page 1 process.
Another option, if viable is to use ASP.Net caching.