473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

2 questions about response.redirect, ClientScript.Register and postbackUrl

Hi,

I have two questions:

1) With this code, i never see the alert message. Why? How to see it?

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "myscript", _
" alert('you go to stating page.');", True)
response.redirect("start.aspx", false)

2) with this code, when clicking on button1, nothing happens. Why and how to
solve that?

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "myscript", _
" alert('you go to stating page.');" & _
" window.location.href='start.aspx';", True)

<asp:Button ID="Button1" runat="server" Text="click"
PostBackUrl="~/start.aspx" />

Thanks
Tony
Nov 9 '08 #1
5 4568
Sorry, the second question contained a little error: here the new version:

1) With this code, i never see the alert message. Why? How to see it?

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "myscript", _
" alert('you go to stating page.');", True)
response.redirect("start.aspx", false)

2) with this code, when clicking on button1, instead of going to file
anywhere.aspx, nothing happens. Why and how to
solve that?

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "myscript", _
" alert('you go to stating page.');" & _
" window.location.href='start.aspx';", True)

This is into file start.aspx:
<asp:Button ID="Button1" runat="server" Text="click"
PostBackUrl="~/ANYWHERE.aspx" />

Thanks
Tony
"Tony" <tr*@sfgv.sgschreef in bericht
news:%2*****************@TK2MSFTNGP06.phx.gbl...
Hi,

I have two questions:

1) With this code, i never see the alert message. Why? How to see it?

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "myscript", _
" alert('you go to stating page.');", True)
response.redirect("start.aspx", false)

2) with this code, when clicking on button1, nothing happens. Why and how
to solve that?

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "myscript", _
" alert('you go to stating page.');" & _
" window.location.href='start.aspx';", True)

<asp:Button ID="Button1" runat="server" Text="click"
PostBackUrl="~/start.aspx" />

Thanks
Tony

Nov 9 '08 #2
"Tony" <tr*@sfgv.sgwrote in message
news:O8*************@TK2MSFTNGP04.phx.gbl...
Sorry, the second question contained a little error: here the new version:

1) With this code, I never see the alert message. Why?

Page.ClientScript.RegisterClientScriptBlock(Me.Get Type(), "myscript", _
" alert('you go to stating page.');", True)
Response.Redirect("start.aspx", false)
Because the page never gets rendered to the browser. Response.Redirect
happens server-side.
How to see it?
ClientScript.RegisterClientScriptBlock(GetType(), "myscript", _
"alert('you go to stating page.');window.location='start.aspx';", True)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 9 '08 #3
Thanks for replying...
Any idea about my second question?
Thanks

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netschreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
"Tony" <tr*@sfgv.sgwrote in message
news:O8*************@TK2MSFTNGP04.phx.gbl...
>Sorry, the second question contained a little error: here the new
version:

1) With this code, I never see the alert message. Why?

Page.ClientScript.RegisterClientScriptBlock(Me.Ge tType(), "myscript", _
" alert('you go to stating page.');", True)
Response.Redirect("start.aspx", false)

Because the page never gets rendered to the browser. Response.Redirect
happens server-side.
>How to see it?

ClientScript.RegisterClientScriptBlock(GetType(), "myscript", _
"alert('you go to stating page.');window.location='start.aspx';", True)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 9 '08 #4
"Eric" <er*@sdsclem.powrote in message
news:u%****************@TK2MSFTNGP02.phx.gbl...
Any idea about my second question?
Not initially. I tried something similar and it worked correctly.

What happens if you set the PostbackUrl to a page which doesn't exist? Does
that generate a standard 404 error...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 9 '08 #5
Does that generate a standard 404 error...?
Yes
i solved it by using Sub Button1_Click
It works that way
Thanks
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netschreef in bericht
news:%2****************@TK2MSFTNGP06.phx.gbl...
"Eric" <er*@sdsclem.powrote in message
news:u%****************@TK2MSFTNGP02.phx.gbl...
>Any idea about my second question?
Not initially. I tried something similar and it worked correctly.

What happens if you set the PostbackUrl to a page which doesn't exist?
Does that generate a standard 404 error...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 9 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ssss ggggg | last post by:
I have response.redirect("/home.asp") in my code but instead of redirecting to that page it sometimes redirects to the current page ("register.asp"). Its temperamental. Has this happened to anyone...
0
by: ven | last post by:
hello i have problem with response.redirect method, namely i have default page home.aspx where is html table : <%@ Page Language="VB" %> <script runat="server"> ' Insert page code here '
5
by: ODAN | last post by:
We are testing a ASP.NET application in Visual Studion 2003 and written in C#. One of the pages that register new users on this application fails to redirect to another page when the button is...
2
by: Dave Mathew | last post by:
I'm trying to run some clientside javascript on page load for one of my ASP.Net pages. I am using the ClientScript.RegisterClient....() methods to register an external javascript file within...
3
by: Stan SR | last post by:
Hi, I need to place some javascript code at the end of my aspx page. How can I do that using the ClientScript.RegisterClientScriptBlock ? Thanks Stan
4
by: shamirza | last post by:
4 9 6 18.ATLAS-AJAX Note: - As an IT professional it's useful to know what the difference is between Hype and usefulness. For instance if there is a new technology coming in many programmers...
9
by: Dariusz Tomoń | last post by:
Hello, I'd like to include JS from C# code (ASP.NET 2.0). I'm trying not directly from i.e. default.aspx.cs code but from a class belonging to DLL, which is referred in my project. The code...
7
by: =?Utf-8?B?YWxiZXJ0b3Nvcmlh?= | last post by:
Hi everybody, I'm using a system.timers.timer object like this: Dim aTimer As New System.Timers.Timer() In my page_load event I use this: aTimer.Interval = 5000 aTimer.Enabled = True...
2
by: daveh551 | last post by:
Okay, I asked a question a week or so ago asking for an explanation on relative URL's and the "~" symbol, and several people explained that the "~" is only usable when the URL is going to be parsed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.