I have an ASP.Net page that does a Response.Redire ct to a code-created url.
Is there any way to code the redirect to open a new window similar to the
Javascript window.open() ? Thanks.
David
Sep 5 '07
21 2409
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
>>Solved! I need to add "javascript :" before the "window.ope n" command, and have the full url there.
Curious - that should only be required for pseudo-URLs i.e. making the hyperlink run a bespoke JavaScript function...
????? I don't understand what you mean. I used:
onclick="javasc ript:window.ope n('the_page_url _including_http ');"
Yes, but you shouldn't have needed to use javascript : in front of
window.open...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
I guess I didn't mention it clearly enough about being in the same window.
OK, then, how do I get the value of a control from the caller page when I
am in the called page? As I have said, I have accomplished the navigation
(though I wish it weren't Javascript), but I need something to do what I
had done in php with $_GET.
OK - let's take a step back here...
Firstly, taking ASP.NET completely out of the equation for a second, there's
no requirement whatsoever to use JavaScript to move from one page to
another - that's what hyperlinks are for:
<a href='mysecondp age.aspx'>Secon d page</a>
Secondly, passing parameters from one page to the next can be easily
achieved via querystrings:
<a href='mysecondp age.aspx?ID=2'> Second page</a>
In the Page_Load of the second page:
int ID = Convert.ToInt32 (Request.QueryS tring["ID"]);
Thirdly, in ASP.NET, if you want to persist data across pages, you have
several options:
1) You can still use the QueryString method
2) You can use postbacks and the Session object
3) In ASP.NET 2, you can do cross-page posting: http://msdn2.microsoft.com/en-us/lib...39(vs.80).aspx
This is, essentially, submitting one page to another page...
Finally, the best advice I can give you is to completely forget about PHP -
none of it will be of any use to you in ASP.NET...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
OK, Mark, I don't know where I am going wrong:
company.aspx:
<asp:Button ID="agents" runat="server" Text="Agents" OnClick="agents _Click"
/></asp:Button>
company.aspx.vb :
Sub agents_Click(By Val sender As Object, ByVal e As Suystem.EventAr gs)
Session["acct"] = acct.Text
Resume.Redirect (agents.aspx, false)
End Sub
agents.aspx.vb:
Sub Page_Load(ByVal sender As Object, ByVal e As Suystem.EventAr gs)
accountNumber = Session["acct"].ToString()
Session.Remove["acct"]
End Sub
What I get is: BC30545: Property Access must assign to the property or use
its value
and it points to the Session["acct"] = acct.Text line. Note that there is a
control called acct in company.aspx
Shelly
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
OK, Mark, I don't know where I am going wrong:
accountNumber = Session["acct"].ToString()
accountNumber.T ext = Session["acct"].ToString()
Assuming accountNumber is a TextBox control...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
Of couse the agents.aspx is inclosed in quotes (typo) in the redirect line.
I also tried commenting out the session variable statements and tried
"agents.aspx?ac ct=1106" and used the Request.QuerySt ring("acct"). This
didn't give an exception (and took me to the page), but didn't set the
accountNumber.T ext either.
Also, with the Redirect, the back button becomes disabled. Is this expected
?
Shelly
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
>
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
OK, Mark, I don't know where I am going wrong:
company.aspx:
<asp:Button ID="agents" runat="server" Text="Agents"
OnClick="agents _Click" /></asp:Button>
company.aspx.vb :
Sub agents_Click(By Val sender As Object, ByVal e As Suystem.EventAr gs)
Session["acct"] = acct.Text
Resume.Redirect (agents.aspx, false)
End Sub
agents.aspx.vb:
Sub Page_Load(ByVal sender As Object, ByVal e As Suystem.EventAr gs)
accountNumber = Session["acct"].ToString()
Session.Remove["acct"]
End Sub
What I get is: BC30545: Property Access must assign to the property or
use its value
and it points to the Session["acct"] = acct.Text line. Note that there is
a control called acct in company.aspx
Shelly
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
>OK, Mark, I don't know where I am going wrong:
> accountNumber = Session["acct"].ToString()
accountNumber.T ext = Session["acct"].ToString()
Assuming accountNumber is a TextBox control...
It is.
Shelly
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
Of couse the agents.aspx is inclosed in quotes (typo) in the redirect
line.
And it's Response.Redire ct, not Resume.Redirect - missed that in my previous
reply...
I also tried commenting out the session variable statements and tried
"agents.aspx?ac ct=1106" and used the Request.QuerySt ring("acct"). This
didn't give an exception (and took me to the page), but didn't set the
accountNumber.T ext either.
Request.QuerySt ring("acct").To String()
Also, with the Redirect, the back button becomes disabled. Is this
expected ?
No..
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:ec******** ******@TK2MSFTN GP03.phx.gbl...
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
>Of couse the agents.aspx is inclosed in quotes (typo) in the redirect line.
And it's Response.Redire ct, not Resume.Redirect - missed that in my
previous reply...
>I also tried commenting out the session variable statements and tried "agents.aspx?a cct=1106" and used the Request.QuerySt ring("acct"). This didn't give an exception (and took me to the page), but didn't set the accountNumber. Text either.
Request.QuerySt ring("acct").To String()
>Also, with the Redirect, the back button becomes disabled. Is this expected ?
No..
(A)
I fixed it to Response.QueryS tring("acct").T oString()
and Response.Redire ct("agents.aspx ?acct=1106", false)
It (1) goes to that page, (2) the back button is there, and (3) nothing
shows in accountNumber.T ext
(B)
Also, using the other method, why couldn't I set a session variable. It
complained about that line. When I put in that line and started typing
session, it filled out the word "Session". But after I put in the rest
andgot to the acct.Text part, it didn't present me with acct (or anything,
for that matter) when I started typing it. If I start a line with ac it
presents me with the control acct, just not after the 'Session["acct"] ='
start of the line.
So, I still have two problems.
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
Also, using the other method, why couldn't I set a session variable. It
complained about that line. When I put in that line and started typing
session, it filled out the word "Session". But after I put in the rest
andgot to the acct.Text part, it didn't present me with acct (or anything,
for that matter) when I started typing it. If I start a line with ac it
presents me with the control acct, just not after the 'Session["acct"] ='
start of the line.
Apologies, I think that's my fault...
I never go anywhere near VB.NET, so I sometimes forget the syntatical
differences...
If, instead of Session["acct"] you try Session("acct") does it work...?
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
"Shelly" <sh************ @asap-consult.comwrot e in message
news:13******** *****@corp.supe rnews.com...
>Also, using the other method, why couldn't I set a session variable. It complained about that line. When I put in that line and started typing session, it filled out the word "Session". But after I put in the rest andgot to the acct.Text part, it didn't present me with acct (or anything, for that matter) when I started typing it. If I start a line with ac it presents me with the control acct, just not after the 'Session["acct"] =' start of the line.
Apologies, I think that's my fault...
Man, he is human after all :-) I'll match your one against my [at least]
100.
>
I never go anywhere near VB.NET, so I sometimes forget the syntatical
differences...
I would have used C#, except that most of the jobs here seem to say VB.Net.
So, I went that way. (I tell you it is a bitch to go back and forth between
a sentence delimited language (C#, PHP, C, Java, etc.) and a card image [aka
lines] one (VB, Fortran, Basic). I always seem to leave of the ";" when I
flip back :-) )
>
If, instead of Session["acct"] you try Session("acct") does it work...?
Well, it didn't produce any errors, but it didn't get the value either.
In company.aspx.vb I have in the agents_Click subroutine:
Session("acct") = acct.Text
Response.Redire ct("agents.aspx ", False)
and in the agents.aspx.vb Page_load I have:
accountNumber.T ext = Session("acct") .ToString()
Session.Remove( "acct")
and, yes, there is a TextBox control "acct" in company.aspx and there is a
TextBox control accountNumber in agents.aspx.
So, now there are two things that give the next page, but neither way gives
me either session variable or the passed variable.
Shelly This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul |
last post by:
I link to a web site from an Excel spreadsheet. The page i link to is
getCookie.asp which sets a cookie then returns back some html which opens a
new window, to the same site but a different page (same folder).
The cookie is not received. Can someone explain why?
I worked around this by adding a cache-control header with a value of
no-cache. This fixes the problem. Unfortunately that causes another
problem with Internet Explorer...
|
by: Les |
last post by:
Hi,
I'd like to find out how to use the window.open() script in Fireworks MX. I have posted my question in the Fireworks forum but
didn't get any replies. Since it's javascript, maybe someone could help me here...?
I'd like to use the window.open() script to open a separate window, because I'd like to hide the menubar and specify the
window size as well. So I specify "javascript:window.open(...)" as the HTML link for a hotspot. However,...
|
by: Marshall Dudley |
last post by:
When I do the following line in Netscape, the popup loads as it should,
but the parent window usually, but not always, reloads as well.
<a href="#"
onClick="window.open('/cgi-bin/displayimage.cgi?/store/demo/image.jpg&YOUR+PRODUCT%27<b>S+NAME+GOES',
'fullimage', 'WIDTH=420,HEIGHT=405,status=0')">
The original window should not reload, but is, and I have tested it with
both version 4.72 and 7.02, and they both do it. IE does not do it....
|
by: David McCulloch |
last post by:
The following code opens a new window, but the "resizeTo" doesn't resize it.
Why not?
(Don't ask why I simply did not open the window with the new size....my
original problem was how to open a new window with maximized dimensions!)
FYI, I uploaded the same code to:
http://tosasoft.com/test/open.htm
========================================
|
by: Samir Pandey |
last post by:
Hello,
I am using the following javascript code to open a new window.
Somehow, IE always opens a new window. It doesn't open target url in
the window name given.
All i want is, if there is a window "MyWin" already open, then the
main window should load the target url in "MyWin" and not open a new
window again.
| |
by: NeverLift |
last post by:
But, if it's not open, I don't want to open it . . . using
window.open will open it if it doesn't exist, even if the url in that
open is null (the window is then empty -- but it's open).
The situation is: A main window opens child windows one at a time as
the user requests, each with its own name. The user may click in any
child window or the main window to open a summary window, which has a
name all windows know. I want to get that...
|
by: Larry R Harrison Jr |
last post by:
I have pull-down menus in javascript and I have the code for opening a link
in a new window. But I want it to open a full-sized window. I can't figure
out the syntax. What I have so far:
Menu5_5_1=new Array("'Lonely Church","javascript:window.open
('http://www.photo.net/photodb/photo?photo_id=2640310')","",0,20,300);
That works fine, except I can't figure out how to modify it to make it open
full-screen.
|
by: Dominic Tocci |
last post by:
I'm searching for a way to use window.open on my web page to open a window
in firefox that allows the sidebars to work (bookmarks, history, etc).
When I use the following:
var
popWindow=window.open('http://www.yahoo.com','','width=600,height=400,toolbar=1,location=1,menubar=1,resizable=1,titlebar=1,directories=1,status=1,scrollbars=1');
the sidebars are disabled. I click on the buttons for bookmarks and history
and they do nothing. I...
|
by: anthony.turcotte |
last post by:
Hi,
I've looked for a solution to this problem on google, read posts in
this newsgroup and I still haven't found anything that could help me.
Here's the scenario.
1. User accesses pageA.html
2. User clicks on menu link to open popup.html
3. pageA.html checks if popup.html is already open. It is not, open
|
by: Geoff Fox |
last post by:
I am in the final moments of designing a new website. One of the pages
(http://www.auditionfactory.com/samples.php) has four links to show
sample work. I would like these links to open new browser windows when
clicked. I have found scripts that will allow one to open, and a few
that claim to all multiples to be opened, but so far nothing that will
allow a user to open multiple new windows as they click to see new
samples.
Does anyone...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |