Print Page | Close Window

Redirection

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7870
Printed Date: 28 March 2026 at 9:08am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Redirection
Posted By: Leeb65
Subject: Redirection
Date Posted: 05 December 2003 at 2:50am

Hello all,

I have a problem that I have never seen before and I am not sure if it's settings or my code (what there is of it!).

I use XML/XSL to create a quiz page then when the user has answered all the questions and they click the next link, a javascript function is called and the score is added up. If the score = 3 the browser should redirect to another page. This is not happening!!

I have tried with javascript and C# and nothing works. The code is executing but the page remains there  Like it's been stuck there!

Code:

C#: in Page_Load

int iScore = Convert.ToInt32(Request["hidScore"]);

if(IsPostBack)

{

if(iScore==3)

Response.Redirect("quiz-formular.aspx");

}

 

Javascript:

 function validate() { //stop

score = score1 + score2 + score3;

if(score==3) { document.getElementById('hidScore').value = score; Form1.submit(); } }

I have tried with window.location.href = <full http path to the page> but nothing seems to work.

Can you please help me?

Thanks

Lee 




Replies:
Posted By: Leeb65
Date Posted: 10 December 2003 at 1:05am

Okay, I found the answer to that problem and it appears that I cannot submit the form properly from an <A> tag.

Has anyone any idea why this is?

Thanks

Lee



Posted By: fernan82
Date Posted: 11 December 2003 at 12:41am
Where's your code to submit the form?

something like:

<a href="javascript:document.frm.submit();">Submit</a>

should work. It doesn't work when there's a submit button on the form so if you got a submit button make it a regular button and add the submit on the onClick event. If you got any <button></button> tags their type is submit by default so you need to add the type="button" property.

I'm not sure that's what you mean though...


-------------
FeRnAN
http://www.danasoft.com/">


Posted By: Leeb65
Date Posted: 11 December 2003 at 1:25am

Hi Fernan, Thanks for your input.

I had already tried your method, but it didn't work. The site is in a frameset (bad practice I know, but it was already designed as far as the HTLM goes.)

So I sent the information to another document in another frame and that told the correct document to load in the correct frame.

F.Y.I. There are 3 button types in VS.NET (button, submit & reset)

Lee



Posted By: MorningZ
Date Posted: 11 December 2003 at 5:24am
Originally posted by Leeb65 Leeb65 wrote:

Okay, I found the answer to that problem and it appears that I cannot submit the form properly from an <A> tag.

Has anyone any idea why this is?

Thanks

Lee

it's called the http://www.w3schools.com/aspnet/control_linkbutton.asp - "LinkButton" control



-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net