change pages

  • Thread starter Thread starter Martin Eyles
  • Start date Start date
M

Martin Eyles

Hi,

I want a button, which when clicked sends you to another page in my asp.net
webapp. I currently use javascript:self.location to do this, but if
javascript is off in the client this wouldn't work. Is there a better way?

Thanks,
Martin
 
have you tryed using the onclick button event
eg
<input type="submit" name="next" value="next" onclick="yourpage.asp">
hope it helps
just a try
 
There is no need to try that code. It doesn't work.

The onclick property is an client script event. You can't put an url in
it and expect it to do anything with it. You have to put Javascript code
in it:

<input type="submit" name="next" value="next"
onclick="window.location='yourpage.asp';">
 
If Javascript is disabled you have only two options:

:: Use the asp:Button control which make a Response.Redirect in the
click event.

:: Use a link. You can use CSS to give it a button like apperance.
 
Göran Andersson said:
If Javascript is disabled you have only two options:

:: Use the asp:Button control which make a Response.Redirect in the click
event.

Doesn't that use javascript? (the __doPostBack function)
 
no. asp:buttons render as submit buttons, and do not use client script to
postback. not sure why you would not use an anchor for what you want.

-- bruce (sqlwork.com)
 
bruce barker (sqlwork.com) said:
no. asp:buttons render as submit buttons, and do not use client script to
postback. not sure why you would not use an anchor for what you want.

-- bruce (sqlwork.com)

Thanks,
I'll probably use anchors, as I think I can fix the styling. I just
wanted to be sure I'd covered all options, which I think have been now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top