.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Ajax Post Form

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

Ok I have an interesting new assignment that I am trying to come up with the best solution for. Basically I have a web application that needs to provide access to another system from within a secured login, each application is at a different site. Basically the third party company that has the system I need to connect with wants me to access their site via a form post. This would typically not be a problem other than I need to have the option to connect from inside of pretty much every existing page withn the primary application. Each connection option will be some type of hyperlink that will then in turn target a new browser window to display the content from the third party. So obviously I cannot use the standard form post methods as the page form is already in use.

So my thought was to use Jquery Ajax Post, I use it all the time for typical Ajax functionality with other applications, but that is normally interaction with a webservice or webmethod. What I was thinking, is to create a post function to send all the required fields along to the third party company, without the need to actually create the form. Typically in the past when I have used this functionality I am returning some type of data that I just redisplay or interact with, but now I need to target a new browser and open the returned page. The third part

View Complete Post

More Related Resource Links

AJAX Form POST Request to a DLL Problem

I am using AJAX javascript for POSTING a complete HTML form to the server which is an external dll on a different server and displaying the response. The server-response is displayed in a "div" . basically i need to show a poll in a .aspx page which is basic a question with 3 options & a button. Now on click of submit button i need to post the data to a dll & show the result from the dll itself. Any idea how to do this? is it possible..any code???

Help with form input and post


I'm trying to teach myself MVC and have been having a few problems trying to handle a form input and post scenario. I am trying to have a section at the top for searching that appears on every page (like there is on sites like amazon).

I've read websites such as: http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvc-framework-part-4-handling-form-edit-and-post-scenarios.aspx and tried to follow their example form post code in my Site.master file. 

The problem I'm having is that it always calls the default controller action, regardless of what I put as the url in the form action (in fact, I can even remove the form tags altogether and it doesn't seem to make a difference -the text box will still call the default controller when I press enter).

In my site master file, I have tried the using the following html markup:

<form action="Home/SearchResults" method="post">
                    <input id="Search" type="text" name="searchText" />
                    <input type="submit" value="Search" />


which is the for

Using ajax to submit and update form


Hi all,

  I'm new to ajax and not sure if it's necessarily the technology I need to accompolish what I'm looking to do. What I'd like to have is a simple two textbox and button form that let's the user submit some credentials (not for logging in) but instead to verify their identity for other purposes.  I would label the button as "Continue" and assuming it passes through, the form would update with some new data entry controls that would allow them to submit some final information.  I thought perhaps ajax would be a nice way to do this since I wouldn't need to create a second continuation page from the first to display a new form.  However, I'm unsure how it's possible to update the form in the first place to look different.  Or is there perhaps a cleaner way to do this?  Any help would be appreciated.  Thanks

$.ajax post from asp.net page and __viewstate causing call to fail



Now I know that I won't be sending viewstate and eventvalidation in my ajax calls and that I will only want to send the actual form fields for efficiency purposes but I will need to know the answer to this question, to inform the more junior members of the team and my manager, so if anyone has any answers they are most welcome.

I have a simple form as follows

<form id="form1" runat="server"> 
<p>Field1: <

POST from html form viewstate problem

<p> Hi all, I have a website where people need to pay for a specific download (.pdf file). After they payed they get the download(A). My payment-provider can do a HTML-Postback to the site i want, for each succesfull payment. So the idea is that if someone payed, they do a postback to my server with a couple of parameters, so i can know that that specific email address has payed, and they get the download. I tested localy with a .html file on my desktop to postback a set of parameters to my local asp.net website. But in ONLY works if i include the __VIEWSTATE in my html file. And i cant get rid of the viewstate in my HTML of the aspx page. >test.html: <html><head></head><body> <h1>Dit is een test</h1> <form id="form1" action="http://localhost:25659/WebForm1.aspx" method="POST"> <input id="Button1" type="submit" value="submit!"/> 'IT ONLY WORKS IF I INCLUDE THE NEXT LINE: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMjA0OTM4MTAwNGRk" /> </form></body></html> Has anybody an idea to acomplish my goal? Maybe i can get some info about the postback in my global.asax? or create a HttpHandler for .html files? Anyone?   Thanks in advance, Vincent   </p>

Post the SAML Response in an HTML form to the assertion consumer service

Hi,   Can anyoner please help me in how to post the SAML Response in an HTML form to the assertion consumer service. I have generated the saml reponse and want to send the same to the re-directing url.  

AJAX, Data Form Web Part, and Paging

I've placed a Data Form Web Part into an Update Panel, and it works great.  This particular use of the web part requires Single Item mode with paging.  My problem is that the "Previous" button for paging calls a javascript function for "history.back()".  Well, the only history to go back to since I am using AJAX around the web part is whatever page (if any) that the user was on before navigating to the page with the AJAX functionality.  It does not go to the previous list item.I've copied the function from the "Next" button, and created my own xslt variables to pass into it for the previous item:<xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$PreviousRow,'};dvt_startposition={',$PreviousPageData,'}'))" />This works fine UNLESS items are deleted from the List that is providing that data to the Web Part. Then my idea doesn't work because it is trying to look for ID numbers that do not exist in the list anymore.  Does anyone know of a way, or a built in variable from the ddwrt namespace, that will pass the previous list item to the "Previous" button no matter if there are deleted items (missing ID numbers) in the providing list? I would greatly appreciate some help.Thanks. Jason A. Graham http://jasonAgraham.spaces.live.com

I don't want Form to Post with ENTER key

 Hi all, I have done much searching and tried capturing javascript keydown events and such but cannot seem to stop a form from posting upon the user typing the ENTER key. I am using VB with VS 2008 SP1 and .NET 3.5 SP1. However, the ENTER key should function properly within a textarea input. So I have refrained from placing the keydown event in the Body tag. So I have wired up keydown events in 6 <asp:textboxes> that use the AutoComplete Extender. The javascript called is: function on_keydown(e) { var keynum; var keychar; var numcheck; if (window.event.keyCode == 13) { event.returnValue = false; event.cancel = true; } else if (e.which) // Netscape/Firefox/Opera { if (e.which == 13) { e.returnValue = false; e.cancel = true; } } This does not work and the form posts anyway. Actually, for those 6 texboxes I would like the Enter key to act as if Tab has been typed...ideally. Please note that I am also using a Master Page. Also for some reason when I first wrote this app a year ago I chose to use an input for the "save" button as in: <input runat="server" type="Submit" id="btnSave> Lastly I also call a JS validation routine prior to post. Can I retrieve the last keypress within that routine? In Clipper language there was a handy Lastkey function. Yes I've been programming since the DOS days. Can someone tell m

Loading graphics without Ajax on submit and before Post Back

Hi, In order to maintain the view state information, I have decided not to use update panel for the loading image. Instead is there a way where I can simply make an image invisible, and display the image on click of the search button and hide it when the page post back again ?    Please advise.  

ASP.NET AJAX Post back happening in IE7 but works good in Firefox


Hi all,

I am debugging one of the project which is implemented using .Net Framework 3.5.

in the home page the project has 5 widgets.

In one of the widget contains a two radio buttons and a save button.When ever the user tries to change the Radiobutton option and Save the results will be displayed properly in Firefox.

But in Internet Explorer 7 the page gets a post back and all the widgets will be reloaded and finally the default radio button will be selected as default instead of the option which i selected.

Can any one help me to resolve this issue.

thanks in advance

How WCF 4 REST Service Support Form Post As Well As XML and JSON?


Using the rest 4 template.  I have a POST method defined, with an object as a parameter.  REST 4 does a great job of automatically mapping both xml and json posts to the method.  I tested this using an HttpClient test application to build and post xml content and then json content. 

I want to also support a standard form post to the method but am having problems!  

I'd like the same method already accepting and converting both xml and json to also work correctly for a form post.  I am testing this by creating an HttpUrlEncoded form in the test client, adding form name/value pairs that match what the method is expecting, and trying to post it.

However I get a 400 Bad Request.  Here's some example code that is returning a 400 bad request:

            var client = new HttpClient();

            HttpUrlEncodedForm form = new HttpUrlEncodedForm();
            form.Add("Id", "99");
            form.Add("Message", "Message test with 'special' chars #!#");
            form.Add("IpAddress", "");

            var response = client.Post("<valid-uri-here>", form.CreateHttpContent());


need a way to post a form in my .aspx page to an external URL


I'm migrating an old ColdFusion site to ASP.NET. One of the pages has a form that posts to an external URL.

<form action='https://www.innlinkcrs.com/rescreate.asp' method='get'>

I just discovered that you can't do this in an .aspx page. Seems the page will just post to itself if you hit the submit button.

What's the proper technique for achieving this in ASP.NET? There are a couple of hidden fields that pass parameters to the external URL.


wcf 4 rest service accepts xml and json posts but get 400 bad request on form post


Using the rest 4 template.  I have a POST method defined, with an object as a parameter.  REST 4 does a great job of automatically mapping both xml and json posts to the method.  I tested this using an HttpClient test application to build and post xml content and then json content.  All data gets correctly mapped to the corresponding properties in my entity. 

I want to also support a standard form post to the method but am having problems! 

I'd like the same method already accepting and converting both xml and json to also work correctly for a form post.  I figured it would "just work" but no.

I am testing this by creating an HttpUrlEncoded form in the test client, adding form name/value pairs that match what the method is expecting, and trying to post it.

However I get a 400 Bad Request.  Here's some example code that is returning a 400 bad request:

Really straightforward but fails.  Ideas why? 


      var client = new HttpClient();

      HttpUrlEncodedForm form = new HttpUrlEncodedForm();
      form.Add("Id", "99"<

Why does ajax control not move onto form



Been following help video "Get Started with the ASP.NET AJAX Control Toolkit?" and I got as far as adding a Control from the Ajax toolbox but for some reason the control will not add to the form.

Anyone explain as to why might be.


Run jQuery script after each form post in mvc2 app


I need to exec some js each time a page loads, and also every time a view is returned after a post action.  I use jQuery.ajax to post form - using url of Controller/Action.  Post is successful and response data is correct, but my js doesn't get called.

I had js in a script tag, within the head of my view.aspx, and found that it does not execute each time the response is received after a post action.  I also tried calling this within $(document).ready, but this does not execute after post action.  window.onload also does not exec after post action.

I prefer not to use MS AJAX js lib, but if there is some pageLoad function, I will give it a try.

Is there a native javascript event that is raised when http response is received?  Thanks.

ajax form, add textbox dynamically


Having FooTable1: id, name, lastname and FooTable2: idfromtable1, address... How can I make a view insert where i can have a button (ajax one) to add a textbox relative to FooTable2.address? I want it to work so people could add as many adresses as they want, jsut by clicking the button again to add a new field. I'd like to do so without using JQuery

Send model back when form post


public ActionResult DisplayView1()


  EmployeeModel myModel = new EmployeeModel();


  return View(myModel);


When I hit the sumit button on the view, that's method of the view is "post". How do I pass the original model back to the action?

<form id="employeeForm" name=employeeForm" action=<%Model.ActionName %> method="post">

<%Model.ActionName %> will be in this example equals "PostBackFromView"

I would like to have this:


public ActionResult PostBackFromView(EmployeeModel model)



What should I do in the view to enable the pass back of the model?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend