Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2007, 01:15 AM
Authorized User
 
Join Date: Apr 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to open new window on button click

hi guys,
can some1 tell me that how to open new window on button click as well as i want to pass some data on another form

thanks
 
Old April 24th, 2007, 03:35 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

You can use the javascript's window.open() method, and pass the values in querystring to the opened page.

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old April 24th, 2007, 03:43 AM
Authorized User
 
Join Date: Jun 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

in the c# file you write,

button.attributes.add("onclick","javascript:functi on1()");


in the HTML of the page,write the below javascript function

function function1()
{
 window.open("pagename",other attributes whose values are to be passed to other page);
}



Intellectuals solve problems but Genoius avoid problems.
 
Old April 24th, 2007, 03:51 AM
Authorized User
 
Join Date: Apr 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default


thanks sir for ur response
but i m using VBscript
and i want to pass some information with this button click
for eg

session("gender")
session("job_category")

i want that when the another form open on the button click then the value of this session show in new form.


thanks
Quote:
quote:Originally posted by zaheerabbas.sk
 in the c# file you write,

button.attributes.add("onclick","javascript:functi on1()");


in the HTML of the page,write the below javascript function

function function1()
{
window.open("pagename",other attributes whose values are to be passed to other page);
}



Intellectuals solve problems but Genoius avoid problems.
 
Old April 24th, 2007, 03:52 AM
Authorized User
 
Join Date: Apr 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default


thanks sir
but my problem is
I m using VBscript
and i want to pass some information with this button click
for eg

session("gender")
session("job_category")

i want that when the another form open on the button click then the value of this session show in new form.

pls explain it with the help of eg.



thanks

Quote:
quote:Originally posted by mike_remember
 Hi

You can use the javascript's window.open() method, and pass the values in querystring to the opened page.

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old April 25th, 2007, 12:12 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

So, are you using Classic ASP?

 
Old April 25th, 2007, 12:35 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Yes, they have to be using ASP. You need to do something like this:


<script language=javascript>
function openMe()
{
   window.open('page.asp');
}
</script>
<input type="button" onClick="openMe();">

Also, since the data you want to pass along to the new window is stored in Session, you should be able to access your session objects on the popup page *UNLESS* the window you are opening is on another domain.

In any case you could alter the method to something like:

<%
Dim sURL
sURL = "page.asp?gender=" & CStr(Session("gender")) & "&job=" & CStr(Session("job_category"))
%>
<script language=javascript>
function openMe(url)
{
   window.open(url);
}
</script>
<input type="button" onClick="openMe(<%=sURL%>);">

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 28th, 2007, 12:11 AM
Authorized User
 
Join Date: Apr 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i m using Asp.net 2003

Quote:
quote:Originally posted by rstelma
 So, are you using Classic ASP?

 
Old April 28th, 2007, 12:13 AM
Authorized User
 
Join Date: Apr 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for u reply
but i m facing one more prblem
this problem is that there are 5 radio button on every selection of radio button new form will open eg
radio1 is selected then they wl open "genderwisereport.aspx"
radio2 is selected then they wl open "categoryreport.aspx"

how this problem wl solve on this button


Quote:
quote:Originally posted by dparsons
 Yes, they have to be using ASP. You need to do something like this:


<script language=javascript>
function openMe()
{
window.open('page.asp');
}
</script>
<input type="button" onClick="openMe();">

Also, since the data you want to pass along to the new window is stored in Session, you should be able to access your session objects on the popup page *UNLESS* the window you are opening is on another domain.

In any case you could alter the method to something like:

<%
Dim sURL
sURL = "page.asp?gender=" & CStr(Session("gender")) & "&job=" & CStr(Session("job_category"))
%>
<script language=javascript>
function openMe(url)
{
window.open(url);
}
</script>
<input type="button" onClick="openMe(<%=sURL%>);">

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Right click to Open a menu peace2007 Ajax 2 November 5th, 2007 02:25 AM
Open a new window on a button click ag19702004 .NET Framework 2.0 1 January 6th, 2007 12:21 AM
showing a popup window on click widad Classic ASP Basics 4 October 15th, 2004 09:50 AM
On click open a report vita Access 4 October 2nd, 2003 06:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.