Browser back button and state retains? [duplicate] - c#

This question already has answers here:
browser back button is not updating page
(3 answers)
Closed 9 years ago.
I have an eCommerce system where I have listed the Recently Viewed Count and Items as viewer browse its details page.
When the user had viewed any item using any browser and click the Back button of the Browser then, recently viewed items module doesn't get refresh at all. But on reloading the url(Refresh), the module gets refreshed and shows the recently viewed items and Count?

Look to the History.js. This framework uses HTML 5 browser's features and can handle back button events.

Going back does not refresh any data, so you'll need to ask for the information from the server each time you wan't the information updated, for example using Ajax.

Related

Opening a PDF on a web form in asp.net [duplicate]

This question already has answers here:
Creating download link to a file on a file server
(4 answers)
Closed 7 years ago.
I am looking for the simplest way to open a PDF when a link or button is clicked. This is on a web page and for example will say . Any advice on how to store this PDF also so it can be generated and displayed would be greatly appreciated as it is a very large file with massive amount of content. I have tried doing it on the button click event but failed miserable as have never opened a external file before.
Something as simple as. To open the pdf is new tab you want to use _blank value for the target attribute
<a href="PathToYourPdfDocument" target="_blank" >Message Here</a>

How can i have a pages text change based on the button clicked on the previous page in c#? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
So i have a Pricing Table with 3 options, all on Upgrade.aspx.
'Starter'
'Champ'
'Master'
There is a button for each option. They will all navigate to Payment.aspx, but i want some variables, such as cost, and plan name, to be different based on what button they clicked on the previous page.
So if they clicked 'Starter' button, the Payment.aspx page would say Starter. But if they clicked the 'Champ' button, the Payment.aspx page would say Champ.
There are a lot of different ways you could do this. It seems a little ambiguous what would work best for your situation however.
One option is to create a singleton class with a variable which you set via button handles (IE sets the variable to "Starter" if that button was pressed).
Then the view for the Payment.aspx page could pull the information from the singleton class or consume it however you want it to.
You could also use form data, cookies, databases, and a variety of other things. It depends on where you want to store the data and how is easiest for you to store it.
There are a ton of facilities for this kind of event handling. I'd recommend looking at this article and see how it works for you MSDN - Cross-Page Posting in ASP.NET Web forms

Automatically clicking an input button C# [duplicate]

This question already has answers here:
C# Webbrowser Automation
(3 answers)
Closed 8 years ago.
How would I go about making a program that clicks on a <input type="button"> button automatically?
Could I do this using the WebClient class?
I am making the program using visual C#,but I am open to using other languages.
To be more specific about my problem:
there is a website I use that generates data upon clicking an input button on the users profile page. I want to make a program that clicks the input button for multiple users in order to update all their profiles at once, instead of manually visiting all their profiles and clicking the button on each persons profile.
you can directly call your button click event on pageload as:
btnSave_Click(btnSave,null);
Or in Jquery:
$(document).ready(function(){
$("[id*='btnSave']").click();
});

Disable page state in ASP.NET C# [duplicate]

This question already has answers here:
Webforms Refresh problem
(2 answers)
Closed 8 years ago.
I´ve an WebForms application with a simple form which persists values in the DB. The problem is: if I refresh this page (a simple F5), even when the form fields are empty, the last values are persisted again in the DB.
I just want to disable this behavior. How can I do this?
Thanks!
This can be solved with the post-redirect-get pattern. When submitting the form (POST request) the server redirects to a page (e.g. the detail page of the object just modified). This way you "clear" the POST request from the browser history. The user can easily navigate back without having anything saved again. Of course, if he hits the submit button again the form will be stored again.

How can we make the backward button disable in the all browsers? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Disable browser's back button
Hi everyone,I have a portal site and i want to make the backward button to disable state after the user gets logout.Is it possible by C# programming?Or we need to go for client side scripts like Javascript or jquery?Please help me regarding this .
You can't do anything on the client with server-side code (C#) except send content to the browser.
There are Javascript things you can do to manipulate the history to a degree, but my guess is you have an architecture problem here; There's no reason you should prevent clicking 'back' simply because they have logged out. Your application should detect that they are logged out, and present them with appropriate content.
Finally, to answer your question: You can't just disable the back button. Period.

Categories