Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit Form on Page.Load (sometimes)

Status
Not open for further replies.

Esoteric

ISP
Feb 10, 2001
93
US
I have a page that onload=document.form1.submit() will not work for. However I have some occasions that would be great for.

I want to call the submit funtion from the page_load if this conditions exists.

Code:
If Request.QueryString("CustNumber") <> "" Then
  Button1.focus()
  'We have a customer number so submit the form please
else
  'DO NOT SUBMIT AUTOMATIC
end if

The button is called Button1. Please any help here would be great.

Thanks,

[ Ésôtêrîç ]
 
why not do this on the server? what your outlining is
1. request myform.aspx?custnumber=1
2. load page
3. response to request
4. w/ js if custnumer exists submit form
5. request myform.aspx?custnumber=1
6. process request w/ custnumber
or
1. request myform.aspx
2. load page
3. response to request
4. w/ js if custnumer does not exists
5. user enter information
6. user submits form

instead just do this in the onload event of the page
Code:
if(!string.isnullorempty(querystring["custnumber"]))
{
   //process with customer id
   server.transfer("nextpage.aspx");
   //or response.redirect("nextpage.aspx");
}

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Okay I fixed this issue, duh, it was in the order in which I was doing things. So if the customer number is present then populate the GridViews DUH.

So I didn't even need to submit the form. Thanks for the help guys.

Thanks,

[ Ésôtêrîç ]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top