Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Good morning,
I am creating a popup window in my asp x page by using java script and in popup window i use two buttons cancel and OK buttons, when i click the OK button it should redirect to login page and when i click it redirect in the same page but the problem occurring when im clicking OK button it redirecting to another page but it opening in the another window but i want to redirect in the same window. and im using this in aspx page.


so,please help me

i want to write the code in java script



thank you for help
Posted
Updated 15-Dec-11 18:43pm
v2

Use this

JavaScript
window.location = 'http://www.yourdomain.com'
 
Share this answer
 
Comments
divya reddy.m 16-Dec-11 0:30am    
its not working
shek124 16-Dec-11 3:55am    
can you post the code..
Hi,

Try this...

Add it in the popup page..

HTML
<input type="button" id="btn_re" value="click me" onclick="redirect();" />

JavaScript
function redirect()
     {
     window.top.location="WebForm1.aspx";
     }


Thanks..
 
Share this answer
 
To open in same window with Window.Open() method. you need to pass parameter to it.

JavaScript
function openME()
{
   window.open("test.aspx","_parent");
}


_parent will help you to open page in same window
_blank will open page in new window
bydefault this parameter is _blank
 
Share this answer
 
Comments
divya reddy.m 16-Dec-11 0:41am    
the page loading but not redirecting to my home page and im writing this code

<script type="text/javascript">
function alertpopup(strdelete) {
if (strdelete != null) {

var strondelete='applicationdelete'
confirm('Are you sure you want to delete the record?');

}
if (strondelete != null) {
window.open('Login.aspx','_parent');

}
}
</script>


thank
XML
<script type="text/javascript">
    function jsPop(jsURL, jsWindowNm, jsWidth, jsHeight)
{
    var hdl;
    if(jsURL!="")
    {
        var jsoption = "scrollbars=yes,resizable=no,width=" + jsWidth + ",height=" + jsHeight;
        hdl = window.open(jsURL,jsWindowNm,jsoption );
    }
}
    </script>



call it like this - :

<a href = "#" title="click to view detail" onclick="return jsPop('News.aspx?Breif=<%# DataBinder.Eval (Container.DataItem,"Breif")%>&Heading=<%# DataBinder.Eval (Container.DataItem,"Headline")%>', 'win01', 700, 600);">



change the code according to your need.
 
Share this answer
 
Comments
divya reddy.m 16-Dec-11 1:14am    
hi ujjwal uniyal,

im getting the popup but the problem is when the popup is open and when i click the ok button it redirecting to another window but i want to redirect in same page in same window
Shobana16 16-Dec-11 1:19am    
Hi divya reddy.m ,
Did you try this?
function redirect()
{
window.top.location="WebForm1.aspx";
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900