Solved

Auto-submit a form in C#

Posted on 2008-06-26
3
1,712 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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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