• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1052
  • Last Modified:

VB.NET Open Page Code

Does anybody know what code I can use to make a command button open another aspx page?  I suppose this is similiar to a 'link'.

Any help would be great,
Thanks,
Gareth
0
gaz_sellout
Asked:
gaz_sellout
2 Solutions
 
iboutchkineCommented:
In a button code put
Respond.Redirect("yourpage.aspx")
0
 
iboutchkineCommented:
sorry typo
must be
Response.Redirect("yourpage.aspx")
0
 
esteban_felipeCommented:
Hi gaz_sellout,

If you want to open a new window then use an usual javascript function with window.open():
<input type="button" OnClick="javascript:window.open('newpage.aspx');">


Before you ask.... No, you can't open new windows from server side code.. You could write server side code that renders the javascript function to open the new window, but IMO that's a waiste of work.


Esteban Felipe
www.estebanf.com
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
gaz_selloutAuthor Commented:
Thanks for the help guys.

The problem I have is that I must also use this for a mobile app. and 'Response.Redirect("yourpage.aspx")' throws up an error:

"Calling Response.Redirect on a postback can have unpredictable results on mobile devices and gateways. Use MobilePage.RedirectToMobilePage method instead."

However, I cannot get "MobilePage.RedirectToMobilePage" to work. Any further suggestions on this?
0
 
Arthur_WoodCommented:
Is this in a ASP.NET application?


AW
0
 
BusyPhotoCommented:
your mobile form is already inherited from MobilePage.
just call
Me.RedirectToMobilePage(pagetoredirect)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now