Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 24th, 2007, 02:15 AM
Authorized User
 
Join Date: Apr 2007
Location: delhi, delhi, India.
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
  #2 (permalink)  
Old April 24th, 2007, 04:35 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
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.
  #3 (permalink)  
Old April 24th, 2007, 04:43 AM
Authorized User
 
Join Date: Jun 2006
Location: Hyderabad, Andhrapradesh, India.
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.
  #4 (permalink)  
Old April 24th, 2007, 04:51 AM
Authorized User
 
Join Date: Apr 2007
Location: delhi, delhi, India.
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.
  #5 (permalink)  
Old April 24th, 2007, 04:52 AM
Authorized User
 
Join Date: Apr 2007
Location: delhi, delhi, India.
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.
  #6 (permalink)  
Old April 25th, 2007, 01:12 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

So, are you using Classic ASP?

  #7 (permalink)  
Old April 25th, 2007, 01:35 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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
================================================== =========
  #8 (permalink)  
Old April 28th, 2007, 01:11 AM
Authorized User
 
Join Date: Apr 2007
Location: delhi, delhi, India.
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?

  #9 (permalink)  
Old April 28th, 2007, 01:13 AM
Authorized User
 
Join Date: Apr 2007
Location: delhi, delhi, India.
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
================================================== =========
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 10:50 AM
On click open a report vita Access 4 October 2nd, 2003 07:47 AM



All times are GMT -4. The time now is 06:19 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.