473,795 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmaticall y Refreshing the Page

One thing that I have often needed to do that I have been unable to find a
way to do is refresh the page (basically do the same thing as pressing the
browser's Refresh button). I know how to do this using Javascript/JScript,
but I have situations in which I need it to be done immediately after code
that is part of my other code. Is there any way to do this? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
10 2210
Hi

Do not know if i am correct did u try meta refresh tag of HTML.

Shivprasad Koirala
C# , VB.NET , SQL SERVER , ASP.NET Interview Questions
http://www.geocities.com/dotnetinterviews/

Nov 19 '05 #2
You seem to have misunderstood my question. I want the refreshing to occur
when, and only when, it is called in my code. For example, I might have a
graphic that gets changed when the user presses a button. They do not see
the new graphic unless the page is refreshed. I want to be able to
automatically refresh the page after the graphic is modified, but I don't
want the page to be continually refreshed, because that would be inefficient
and mean that the user might need to wait a certain period of time
(depending on how frequently I set the meta tag to refresh) before seeing
the new graphic.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

<sh**********@y ahoo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi

Do not know if i am correct did u try meta refresh tag of HTML.

Shivprasad Koirala
C# , VB.NET , SQL SERVER , ASP.NET Interview Questions
http://www.geocities.com/dotnetinterviews/

Nov 19 '05 #3
"Nathan Sokalski" <nj********@hot mail.com> wrote in
news:u6******** ******@TK2MSFTN GP12.phx.gbl:
You seem to have misunderstood my question. I want the refreshing to
occur when, and only when, it is called in my code.


I think you have a misunderstandin g of how the web works... The web works
in a request-response fashion, only clients can make requests for data.
Hence, the server (ASP.NET) can force a refresh.

There are a couple solution to emulate what you want:

1. Refresh continously
2. Poll the server via javascript remoting, when the server returns a
positive response, refresh thte apge

Option 1 is easy. Option 2 takes some knowledge of javascript.

--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #4
Nathan,

I assume that the other sample I did sent in your other questions give you
an answer on this?

I hope this helps,

Cor
Nov 19 '05 #5
Ok got it then you can use Cache object where you can specify when the
object changes referesh the cache.

Cache object can further be customized on lot of parameter like values
, time , change in file etc etc.

Shivprasad Koirala
C# , VB.NET , SQL SERVER , ASP.NET Interview Questions
http://www.geocities.com/dotnetinterviews/

Nov 19 '05 #6
Hi, Nathan.

You might want to take a look at:
"Generating Client-Side Script for Postback"

http://msdn.microsoft.com/library/de...orpostback.asp

That article explains how to generate a postback event
in controls other than buttons and image buttons.

Make sure you follow through to the accompanying article:
http://msdn.microsoft.com/library/de...riptsample.asp

That sample creates a custom link button
that initiates postback through client-side script.

For a sample which derives from WebControl,
see "Rendering a Server Control Samples" :

http://msdn.microsoft.com/library/de...olssamples.asp

I see what might be a problem in using these methods, and it's that
synchronizing the client-side script so that it executes *after* your
new image has been created might be tricky.

You might want to consider adding a "Please wait..." message
or a progress bar to your code and introducing a time delay
for the postback to occur, so that enough time elapses before
the page is refreshed by the postback.

For "Please wait..." and progress bar example code, see :

http://www.daveandal.net/books/6744/...implewait.aspx
http://www.daveandal.net/books/6744/...ogressbar.aspx

There's links to source code in both.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:u6******** ******@TK2MSFTN GP12.phx.gbl...
You seem to have misunderstood my question. I want the refreshing to occur when, and
only when, it is called in my code. For example, I might have a graphic that gets
changed when the user presses a button. They do not see the new graphic unless the page
is refreshed. I want to be able to automatically refresh the page after the graphic is
modified, but I don't want the page to be continually refreshed, because that would be
inefficient and mean that the user might need to wait a certain period of time
(depending on how frequently I set the meta tag to refresh) before seeing the new
graphic.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

<sh**********@y ahoo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi

Do not know if i am correct did u try meta refresh tag of HTML.

Shivprasad Koirala
C# , VB.NET , SQL SERVER , ASP.NET Interview Questions
http://www.geocities.com/dotnetinterviews/


Nov 19 '05 #7
I'm not sure if this will help but; this is what I do when I want the page
to be refreshed. It is server based, I find it nessary if a resource on the
server has changed and I want it reflected in the browser.

Public Shared Sub RefreshPage()
Dim httpCxt As System.Web.Http Context = GetHTTPContext( )
httpCxt.Respons e.Redirect(http Cxt.Request.Raw Url) ' RawUrl contains
the full url, including parameters.
End Sub

Public Shared Function GetHTTPContext( ) As System.Web.Http Context
Return (System.Web.Htt pContext.Curren t)
End Function
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:eH******** ******@tk2msftn gp13.phx.gbl...
One thing that I have often needed to do that I have been unable to find a
way to do is refresh the page (basically do the same thing as pressing the
browser's Refresh button). I know how to do this using Javascript/JScript,
but I have situations in which I need it to be done immediately after code
that is part of my other code. Is there any way to do this? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Nov 19 '05 #8
Quick and dirty:

Use SendKeys to send an {f5} to the IE window - bingo
http://msdn.microsoft.com/library/de...ClassTopic.asp

Good luck

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:u6******** ******@TK2MSFTN GP12.phx.gbl...
You seem to have misunderstood my question. I want the refreshing to occur
when, and only when, it is called in my code. For example, I might have a
graphic that gets changed when the user presses a button. They do not see
the new graphic unless the page is refreshed. I want to be able to
automatically refresh the page after the graphic is modified, but I don't
want the page to be continually refreshed, because that would be
inefficient and mean that the user might need to wait a certain period of
time (depending on how frequently I set the meta tag to refresh) before
seeing the new graphic.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

<sh**********@y ahoo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi

Do not know if i am correct did u try meta refresh tag of HTML.

Shivprasad Koirala
C# , VB.NET , SQL SERVER , ASP.NET Interview Questions
http://www.geocities.com/dotnetinterviews/


Nov 19 '05 #9

Nathan -

You can write a little routine to force the page to refresh. You ca
then call this procedure whenever you need to:

In the code behind you will need:

'Build dynamic script to force a postback to the page to get th
new info
Private Sub ForcePostBack()
Dim strRedirectBuil der As StringBuilder = New StringBuilder

strRedirectBuil der.Append("<sc ript language='vbscr ipt'>")
strRedirectBuil der.Append("For ceRefresh()")
strRedirectBuil der.Append("</script>")

Page.RegisterSt artupScript("Re direct"
strRedirectBuil der.ToString)

End Sub

Then in your script you would need:

public sub ForceRefresh()
dim strPath
strPath = "<pagename>.asp x"
window.navigate (strPath)
end sub

Hope this helps

--
Rosann
-----------------------------------------------------------------------
Rosanne's Profile: http://www.highdots.com/forums/m28
View this thread: http://www.highdots.com/forums/t266597

Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

60
4325
by: A.Translator | last post by:
I have been struggling with a page that is based on a table structure (because that is all I am feeling comfortable with at the moment) styled with css. One of the problems I run in to is Opera (Opera 7 in my case). The weird thing is: viewing the page through Opera's eyes the first time around is OK, but after refreshing, the page gets messed up badly. I will look into the cause of the mess, but for now am really curious: what does...
2
1072
by: Nathan Sokalski | last post by:
One thing that I have often needed to do that I have been unable to find a way to do is refresh the page (basically do the same thing as pressing the browser's Refresh button). I know how to do this using Javascript/JScript, but I have situations in which I need it to be done immediately after code that is part of my other code. Is there any way to do this? Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
1
1934
by: Laurent Liegeois | last post by:
Hi, I try to write a Web Custom Control. But I have a little problem for refreshing the properties view of my Web Control in Visual Studio (). When I modify the value of text property of my Control by programing, it changes in the Design view but no in properties viewAnd when in the design view, I lost the focus and I click above my control. It is refreshed and text property contains the good value. Therefore how I refresh...
5
3487
by: Jensen Bredal | last post by:
Hello, I need to display self refreshing information on a web page written with asp.net. I would image that the info would be displayed either as part of a user control or a web control. How can this be done? The information will come from a database and the displaying should loop throug a table in the database. Many thank in advance JB
25
45807
by: bubbles | last post by:
Using Access 2003 front-end, with SQL Server 2005 backend. I need to make the front-end application automatically refresh the linked SQL Server tables. New tables will be added dynamically in the future, so the front-end application must have a way to keep up with this (instead of manually linking them).
4
5062
by: Dan | last post by:
Hi, i'm not sure to understand the difference between refreshing the pagina by clicking on 'refresh' in the browser and a postback. What i think it is: Suppose a page with a form containing a textbox and a dropdowlist: and a button to start something n code-behind: a refresh doesn't send any value back to the server but with a postback, the values are sent? But then, which role does Viewstate play in the postback proces?
13
7457
by: honey99 | last post by:
Hi! I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters the combobox...but the data in the combobox of parent window(Ex1.jsp) is entering only when i refresh...
0
2067
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
1
9413
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in a dialog box ended up opening up a new browser window with the aspx page, I read on a forum that I should use the iframe control and since I have to open a bunch of pages as diaogboxes, I created a general page(Container.aspx) which has an...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.