View Full Version : Help! Respons.Redirect Kicks in Before Button is Clicked


KevinM
02-16-2006, 08:24 AM
Using asp.net 1.1 I habv the following button on my page..

<input type="button" name="btnBack" value="BACK" onClick="<% Response.Redirect("MyPage.aspx")%>"/>

This is within a server side form although the button is not a server control

Problem is the redirect kicks in straight away and 'MyPage.aspx' is opened straight away.

Why is the button's onClick event activating without actually clicking on it?

Cheers

It was so much simpler in classic asp :rolleyes:

Kodo
02-16-2006, 10:11 AM
you can't do that.
Either put a javascript function for the onClick event or use a .net control button and apply the redirect to it's event handler.

KevinM
02-17-2006, 01:34 AM
Yeah, you're right, sorted now, I was just being lazy

Many Thanks