sdlangers Posted May 19, 2003 Posted May 19, 2003 Hi, does anyone know how to capture a refresh page event in asp.net? e.g. to be able to tell (server side) wheter the user has navigated to the page or has refreshed the page? thanks. Quote
Administrators PlausiblyDamp Posted May 19, 2003 Administrators Posted May 19, 2003 check the Page.IsPostBack property in the load event of the page. If it is false then they have navigated to the page, if true then the page is being generated in response to a user action. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
sdlangers Posted May 19, 2003 Author Posted May 19, 2003 yeah - its something like that i need, but i dont think the isPostBack works for refreshing the browser.. what i need is a way to distinguish between the user navigating to a page and a user hitting the browser refresh or f5 thanks for your help Quote
Liqdfire Posted May 20, 2003 Posted May 20, 2003 yeah - its something like that i need, but i dont think the isPostBack works for refreshing the browser.. what i need is a way to distinguish between the user navigating to a page and a user hitting the browser refresh or f5 thanks for your help not really if I am not mistaken the autopostback is false if a user refreshes. Quote
sdlangers Posted May 20, 2003 Author Posted May 20, 2003 Hi, If i have the following code: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here If Page.IsPostBack Then Response.Write("postback is true") Else Response.Write("postback is false") End If End Sub and the page is a simple html page. When it loads first, it displays 'postback is false' when i hit refresh it says 'postback is false' when i navigate to the page (via a link) it says 'postback is false' Am i missing anything or does anyone know another way of doing it? Thanks for your help. Quote
sdlangers Posted May 20, 2003 Author Posted May 20, 2003 so does anyone know if this can it be done? Quote
davemcminoway Posted May 29, 2003 Posted May 29, 2003 I have the same problem. I have a page with a datagrid. If I dont alter the page and hit "Refresh" it works fine. But if I alter a row and hit "Refresh" it doesn't work. Any ideas? Thanks! Dave Quote
russgreen Posted August 10, 2003 Posted August 10, 2003 same as davemcminoway I am in axactly the same position as davemcminoway. Using a datagrid and I want to trap the Broswer refresh to reload my data but not actually refresh the browser. You end up with the update command going off when it shouldn't. Quote Learn Visual Studio .Net My Homepage
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.