Solved

Auto-submit a form in C#

Posted on 2008-06-26
3
1,701 Views
Last Modified: 2013-12-16
Hi,

I have a form with some hidden fields and I wish to auto-submit this in the Page_Load event in the codebehind file (C#), if certain conditions are met, without using a submit button.

For example, if the user's name is "ABC", the form should automatically submit. It then takes him to a different application, using the values of the hidden fields.

Please help.

- A

0
Comment
Question by:arunatata
  • 2
3 Comments
 
LVL 11

Expert Comment

by:anuragal
ID: 21881078
You can acheive this in 2 ways
On page load if certain conditions are met then redirect the user to whereever you want using response.redirect.

Or

On page load if conditions are met then explicitly call the btnSubmit_click event from there only. All the code will get executed that is writtren in that function.

Anurag
0
 

Author Comment

by:arunatata
ID: 21885922
The form's method is "POST" - the variables are going to an external site. How can I submit this data with response.redirect?
0
 
LVL 11

Accepted Solution

by:
anuragal earned 500 total points
ID: 21889424
I was not aware that you are looking for this :-)

Here is the link of one good article from one of my faviourite sites to solve your problem
http://www.codeproject.com/KB/aspnet/jsnopostback.aspx

I hope this will work for you

Anurag

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question