Embedding a Mailchimp form to ASP.NET webforms

A lot of people have problems when they need to include a Sign up form to an ASP.NET based page, you can add the form and it shows up but when you fill it in and click on the Subscribe button it just refreshes the page and nothing else happens.

This is because ASP.NET already defines a <form> tag on the page and it is being executed instead of the <form> tag that the mailchimp code uses.

The problem is that not even mailchimp tells you how to do it, instead they just say that for asp.net pages “some extra work is needed” and then they give you a link to a page that explains about multiple <form> tags in ASP.NET webforms.

You indeed can have multiple form tags with the runat server property but only one can be declared as visible at the time, but guess what, in order to make the mailchilp sign-up form to work you can even forget about using the form tag, it is as simple as this:

  1. Copy the code from mailchimp
  2. Save the url that you find into the “action” property of the form tag
  3. Delete the <form> tag (and the closing </form> tag of course) just leave the div “<div id=”mc_embed_signup”>”
  4. In the submit button code add onClick=this.form.action=’YourURL’;this.form.submit();


This way you are submiting the form without using the form tag and it works fine!.

This of course also applies to non-mailchimp forms, just apply the same method.

Comments are closed.