Friday, 22 March 2013

how to Redirect to another aspx page in Javascript

 


Description:-

  In this example we explain how to redirect to .aspx File from Javascript Function. there is a sitution when the we set timer in javascript function when the time is up then the page is redirect to specify .aspx page. 

To show the Example How to Create Timer in javascript Click Here Create Timer or Display Clock

To Redirect the page in javascript the Location Object is Used:

          Location Object is the PreDefined Object Available in Javascript. It is not created By the User and Location Object Holds the Information of the Current URL.

Property of Javascript Location Objects
Name
Description

host
Specifies the host and domain name, or IP address, of a network host.

hostname
Specifies the host:port portion of the URL.

href
Specifies the entire URL.

pathname
Specifies the URL-path portion of the URL.

protocol
Specifies the beginning of the URL, including the colon.


Methods of Javascript Location Objects
Name
Description

reload
Forces a reload of the window's current document.

replace
Loads the specified URL over the current history entry.


this is very useful example when you have to Redirect your page at Design time means in .Aspx page not in .aspx.cs page so at that time you compulsary have to use a JavaScript.


to show Example of How to Display Gridview Row Detail in Javascript Popup click here Display Gridview ARow Detail in Javascript Popup


to show example of how to create timer or display clock in javascript click here create timer or display clock in javascript

to show example of how to display current time in webpage click here Display current time in webpage


The showresults.aspx is a .aspx web form.

<script type="javascript">
function demo()
{
 window.location.href = "showresults.aspx";
}

</script>



0 comments:

Post a Comment