Hi,
i try to redirect to another aspx page with jscript. I use "OnClientCl ick"
but nothing happens.
I tried two ways.
What am i doing wrong?
Thanks
Dan
....
<form id="form1" runat="server">
<asp:Button ID="ContinueBut ton" runat="server" OnClientClick=" return
profiel()" />
</form>
....
<script language="javas cript" type="text/javascript">
function profiel()
{
//window.location .href="page2.as px"
Response.Redire ct("page2.aspx" )
}
</script> 5 18499
Yes, the problem is that you are trying to use Response.Redire ct (which is
server-side .NET code) in client-side script, which won't work. Use
location.href=n ewurl;
instead.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Dan" wrote:
Hi,
i try to redirect to another aspx page with jscript. I use "OnClientCl ick"
but nothing happens.
I tried two ways.
What am i doing wrong?
Thanks
Dan
....
<form id="form1" runat="server">
<asp:Button ID="ContinueBut ton" runat="server" OnClientClick=" return
profiel()" />
</form>
....
<script language="javas cript" type="text/javascript">
function profiel()
{
//window.location .href="page2.as px"
Response.Redire ct("page2.aspx" )
}
</script>
P.S.
Also, you need to return false after the window.location .href assignment to
prevent your server-side event from firing; then it will work.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Dan" wrote:
Hi,
i try to redirect to another aspx page with jscript. I use "OnClientCl ick"
but nothing happens.
I tried two ways.
What am i doing wrong?
Thanks
Dan
....
<form id="form1" runat="server">
<asp:Button ID="ContinueBut ton" runat="server" OnClientClick=" return
profiel()" />
</form>
....
<script language="javas cript" type="text/javascript">
function profiel()
{
//window.location .href="page2.as px"
Response.Redire ct("page2.aspx" )
}
</script>
On Feb 12, 5:48 pm, Peter Bromberg [C# MVP]
<pbromb...@yaho o.yabbadabbadoo .comwrote:
Yes, the problem is that you are trying to use Response.Redire ct (which is
server-side .NET code) in client-side script, which won't work. Use
location.href=n ewurl;
instead.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Dan" wrote:
Hi,
i try to redirect to another aspx page with jscript. I use "OnClientCl ick"
but nothing happens.
I tried two ways.
What am i doing wrong?
Thanks
Dan
....
<form id="form1" runat="server">
<asp:Button ID="ContinueBut ton" runat="server" OnClientClick=" return
profiel()" />
</form>
....
<script language="javas cript" type="text/javascript">
function profiel()
{
//window.location .href="page2.as px"
Response.Redire ct("page2.aspx" )
}
</script>- Hide quoted text -
I'd recommend to move js above and add "return false"
Example:
<script language="javas cript" type="text/javascript">
function profiel()
{
window.location .href="page2.as px";
return false;
}
</script>
<asp:Button ID="ContinueBut ton" runat="server" OnClientClick=" return
profiel();" />
thanks
"Peter Bromberg [C# MVP]" <pb*******@yaho o.yabbadabbadoo .comschreef in
bericht news:10******** *************** ***********@mic rosoft.com...
P.S.
Also, you need to return false after the window.location .href assignment
to
prevent your server-side event from firing; then it will work.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Dan" wrote:
>Hi,
i try to redirect to another aspx page with jscript. I use "OnClientClick " but nothing happens. I tried two ways. What am i doing wrong? Thanks Dan
.... <form id="form1" runat="server"> <asp:Button ID="ContinueBut ton" runat="server" OnClientClick= "return profiel()" /> </form> ....
<script language="javas cript" type="text/javascript"> function profiel() { //window.location .href="page2.as px" Response.Redir ect("page2.aspx ") } </script>
On Feb 12, 6:03 pm, "Alexey Smirnov" <alexey.smir... @gmail.comwrote :
>
I'd recommend to move js above and add "return false"
Well, Peter mentioned it already :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lozd |
last post by:
Would appreciate any solutions people could offer for this.
Basically I wan't to use a frameset with an aspx page as the contents
rather than a htm page and I'd like to be able to redirect the main page from
the code behind the contents page.
I want to do this to allow the use of asp "linkbuttons" instead of
hyperlinks so I can do a little processing before redirecting. The main
reason for this to prevent hyperlinks of pages that have...
|
by: Paul |
last post by:
Hi all, at present I I've built a website which can be updated by admin and
users.
My problem, I've combined "log in" and "access levels" to restrict access to
certain pages, using the built in "log in" and "user authentication,
restrict access to page" features. But I find the after login I constantly
get redirected from the restricted pages.
|
by: ElmoWatson |
last post by:
I tried on the Security newgroup, as well as other places, and haven't
gotten an answer yet - - I'm pulling my hair out over this one.
I'm trying to get Forms Authentication working.....I can get any requested
page to automatically go to the Login.aspx page, AND, the ReturnURL
querystring is correct in the address bar, but no matter what, I can't get
it, once the user is authenticated, to redirect to the new page. It ALWAYS
refreshes the...
|
by: Ankur Jain |
last post by:
Hi,
I am facing a very weird problem while redirecting to another page.
The problem is as follows:
I have a website. I build the solution and run the application.
The first page is the login page. I enter a valid login and password
and click the "login" button. The click event call the database and
validates the information. After verification the Response.Redirect is
fired. The problem comes here. The redirected page does not come up....
|
by: jtencate |
last post by:
I am trying to add an OnClientClick event to links in an asp:Menu.
I tried using a StaticItemTemplate to bind the MenuItem data to a LinkButton
with an OnClientClick attribute. This works fine to a point. This does get an
OnClientClick event onto the menu items but it causes the codebehind
ItemCommand for the Menu to become unwired. It seems that when my Menu is
rendered to html the link buttons in the menu have two <atags rendered one...
| |
by: Jeff |
last post by:
I'm hoping that someone can help me. I know little javascript and only need
a very small amount in a visual web 2005 application using vb. I'm not sure
whether my problem is related to the java or to the vb, but I'm thinking
that it may likely be the vb.
I'm attempting to open a java modal dialog box from a parent window. I have
most of the dialog box working with one problem. The dialog box opens fine
with the code below associated with...
|
by: Slim |
last post by:
i have a simple page, with one button button1.
when click it creates a new button button 2 and adds a event handler to it.
but when button 2 is clicked nothing happens, why?
Partial Class test_buttons
Inherits System.Web.UI.Page
Dim bt2 As Button
|
by: veerapureddy |
last post by:
Hi All,
I have some problem with browser caching I cleared the cache and also invalidated the session and redirected to the login page if the session has expired, in IE there is no problem if I go back and refresh it is redirecting to the login page, but in mozilla when I click the back button in the browser even its redirecting to the login page but when I refresh the page its showing me the recent page of that particular user loggid in,...
|
by: db007 |
last post by:
I have a problem at the moment with a web project.
I have two Panels within an UpdatePanel on an aspx page (using Masterpages). I'm using ASP.Net 2.0 with an AJAX enabled website.
The two Panels represent a Master-Detail type relationship. I want a user to click a LinkButton in the first Panel and then for the 2nd Panel to be displayed with the detail.
However, I need to set some text properties of textboxes programmatically when the...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |