Groups > Asp .Net > Getting started with ASP.NET > Re: Posting to an ASP page




Posting to an ASP page

Posting to an ASP page
Thu, 3 Apr 2008 15:30:15 +0000
I'm integrating a Classic ASP app into a ASP.NET site.  The ASP app is for
creating, sending, and maintaining newsletters, so the only page the user sees
is the subscription page.  The .net site uses master pages, so I want to make
the subscription page a .net page.  That way the page doesn't get overlooked if
we make any changes to the master file.  

I know I can use a button control as the submit button and put the page it's
posting to in the PostBackUrl property.  However, the Classic ASP form string
looks like this:

<form onsubmit="return formvalidation(this)"
method="post" name="subform"
action="http://www.writeaprisoner.com/nmanagerpro/forms/optIn.asp"
target="blank"> 

I have the javascript functions.  How do I use them to validate the form fields
while posting?   How do I add the target="blank"?

Diane
Post Reply
Re: Posting to an ASP page
Thu, 3 Apr 2008 17:00:42 +0000
Yes you can.  You could even make it so the button isn't visible until
everything is validated.
Post Reply
Re: Posting to an ASP page
Thu, 3 Apr 2008 17:00:57 +0000
if your your function is called in code behind, that means the form has already
been submitted. 

there are 2 ways if you want to stop the button click from submitting the form:

1. write a javascript function instead of code-behind and call it before
submit.

2. use ajax to call your function in code-behind
Post Reply
Re: Posting to an ASP page
Thu, 3 Apr 2008 17:01:14 +0000
if your your function is called in code behind, that means the form has already
been submitted. 

there are 2 ways if you want to stop the button click from submitting the form:

1. write a javascript function instead of code-behind and call it before
submit.

2. use ajax to call your function in code-behind
Post Reply
Re: Posting to an ASP page
Thu, 3 Apr 2008 17:10:45 +0000
Ok, so I took the validation check out of the button click event and put it in
the page load event.  I verified through debugging that this runs first.  So if
the email address doesn't validate, can I stop the button click event from
happening?

Diane
Post Reply
<< Previous 1 2 3 Next >>
( Page 1 of 3 )
about | contact