Solved

Auto-submit a form in C#

Posted on 2008-06-26
3
1,714 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Expert Comment

by:Anurag Agarwal
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:
Anurag Agarwal 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 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