Sub Page_Load (sender As Object, e As EventArgs)
If Not Page.IsPostBack
Session("update") = Server.URLEncode(System.DateTime.Now.ToString())
End If
End Sub
Sub Page_PreRender (sender As Object, e As EventArgs)
ViewState("update") = Session("update")
End Sub
Sub Button1_Click(sender As Object, e As EventArgs)
If Session("update").ToString() = ViewState("update").ToString() Then
'INSERT CODE HERE
Session("update") = Server.URLEncode(System.DateTime.Now.ToString())
End If
End Sub
hi Nimish,
ReplyDeletehope you are doing well.
your code is running properly, but i m unable to get in how this is happening,please help me how the viewstate and session variable value got different when user press refresh button,please reply.
i would be highly appreciate your response.
plz plz plz
you can mail me on sunilgupta333@gmail.com
sunil it is happenning due to the order of page events. plz study page life cycle
ReplyDeletehttp://msdn.microsoft.com/en-us/library/ms178472.aspx