Visual Studio .NET - asp.net 2.0 menu control opening a popup window withouth menubar etc

Asked By shekhar kumar on 02-Dec-08 02:38 AM
I have a menu in asp.net 2.0. Whose navigate url is getting set be database value. The value for new window also coming from database.

Now the problem is this I have to open a popwindow on menu click.
If I set navigate url to javascript:window.open('url','mywin','width=700,height=600');

The page opens but my parent page get refreshed and it does not show anything on the parent page.

If I am setting javascript:window.open('url','mywin','width=700,height=600'); return false;
then there is a java script error.

What I have done is set the navigate url to javascript:window.open('url','mywin','width=700,height=600'); parent.close();

it first opens in in new window then a popup opens and then the parent window get closed.
it's working in IE 6 & 7 but not woking in mozila.
Any one plese help me

Thanks

Thanks but can .... - Asked By shekhar kumar on 02-Dec-08 02:44 AM

Thanks a lot.

But Can i write it to menu control navigate url?

Thanks again.

show Popups different ways page... - C_A P replied to shekhar kumar on 02-Dec-08 02:47 AM

check out code..

<script language="javascript" type="text/javascript" >
function NewWindow(mypage,myname,)
{
win=window.open(mypage,myname);
win.focus();
}

</script>

popup when button click

btnSubmit.Attributes.Add("onclick",NewWindow('LinkPopup.aspx?search='+searchData+'','popup','600','350','center','front');

Popup Radio button

By ASP radio button you mean you are using an <input type="radio"..>
If so you can try
<input type="radio" name="rd1"
onClick="MyWindow=window.open('1.htm','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=380,height=480'); return false;" value="0"/>Yes

<input type="radio" name="rd1" value="0" checked />No

popup from Hyperlink

Hyperlink1.Attributes.Add("onclick", "window.open('popup.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")

Preview the page and your popup will open when the page loads

bodytag.Attributes.Add("onload", "window.open('popup.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")

try this - C_A P replied to shekhar kumar on 02-Dec-08 02:48 AM

I included a javascript that opens up a pop up window:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!-- #INCLUDE FILE="popupWindow.js" -->

The include file file looks like this:

<script language="javascript" type="text/javascript">
<!--

var win=null;

function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}

// -->
</script>

I invoke my pop up window as follows:

<a href="Name of a aspx application.aspx" tabindex=-1 onclick="NewWindow(this.href,'Name of aspx','800','550','yes','center');return false" onfocus="this.blur()"> href display name </a>

Note: the quotes versus double quotes.

In reality I href to a scroll bar load page that then loads my application.
try this link - C_A P replied to shekhar kumar on 02-Dec-08 02:49 AM
http://www.eggheadcafe.com/articles/20060117.asp

http://forums.asp.net/t/986013.aspx