Solved

Auto-submit a form in C#

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now