Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 589
  • Last Modified:

How to execute server code in VB.NET on a button click and then call up another page

I do realize that this is a dumb question, but I am new to ASP.NET, so this should be really easy.

I have an aspx page with a form on it that the user fills out. When they click my Submit button, which is a button called buttonSubmit, but I don't think it is THE submit button. Anyway, this submit button has VB code behind it that saves the data from the form to a database, sends out a confirmation email to the user and another email to us that one was added, and then I simply want it to bring up a different page, a ThankYou page. I just don't have any idea how to tell the server to send back a different page than the one that processed the button.

Please help!
0
jkurant
Asked:
jkurant
  • 4
  • 2
1 Solution
 
LAMASECommented:
AJAX is the way. The button calls the code with http (you need to check the permissions and inputs) and then in js you can do what you want.
For the ajax code, it depends on your website... if no js framework are installed, i suggest jQuery, with his ajax method.
0
 
jkurantAuthor Commented:
LAMASE,

How do I get it to execute the code on the server to insert in the database and send emails from javascript before I set location.href = whatever?
0
 
jkurantAuthor Commented:
my button runs VB code on the server and then it brings back the same page. I want it to go to another page. Isn't this the simplest thing to do? Or do I need to pass back the url i want to go to in a field or something and then have javascript pull that page once the old page comes back, but that sounds like an awful lot of work to do something very simple.

0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
LAMASECommented:
Sorry, I didn't understand in the first post:
Since this is a VB question, I cannot helo you more, sorry, I'm not expert in VB.
0
 
jkurantAuthor Commented:
Response.redirect
0
 
jkurantAuthor Commented:
I had to figure this out myself. I thought it was a super easy question for anyone who develops in ASP.NET, but no one answered the question.
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

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

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