Solved

Master page and HTML FORM tag?

Posted on 2006-11-29
6
1,753 Views
Last Modified: 2010-08-05
How can I use an HTML FORM tag on a content page that uses a Master page?  The HTML FORM is now inside the Master page serverside FORM.  I need to use the HTML FORM on a few pages.

Specifically: I have one page with multiple PayPal "Add to cart" images.  Each image is inside of a FORM.  This is code that comes from PayPal.  So how can I do that with one FORM tag (Master page's FORM)?  

The page has an "Add to cart" for each different product.  Each product one uses a different URL.

Thanks,
Brett
0
Comment
Question by:brettr
  • 3
  • 3
6 Comments
 
LVL 9

Expert Comment

by:stengelj
ID: 18042642
You can add this to your page directive on every page that you need to add an HTML FORM: EnableEventValidation="false"

Or,

You can apply this setting to all of your web pages by  adding this to the system.web section of your web.config file:
<pages validateRequest="false" enableEventValidation="false" />

Before you do this, make sure you understand and are okay with impact this could have on your security.  

See: http://msdn2.microsoft.com/en-us/library/system.web.ui.page.enableeventvalidation.aspx

That should work.

0
 

Author Comment

by:brettr
ID: 18042954
Thanks.  This is close to working.  However, the first FORM doesn't work.  It still references the current URL, which just references the current page.  But all FORMs after on that same page are fine.  So I put an empty FORM first:

<form></form>

and I'm good to go.  Any idea why that is?
0
 
LVL 9

Accepted Solution

by:
stengelj earned 125 total points
ID: 18043039
I haven't used master pages extensively yet, but I have run into situations like this where pages under the master, or web user controls inside a master, need to see a control before it will recognize it.  I don't know why this is or if there is a real fix for this issue, but I usually get around it by loading a "dummy" instance of a control on the master page.  I'm kind of surprised to see this happen with a plain HTML element, but the concept is the same.

Add your dummy <form></form> right after the <form> tag on the master page.  At least then you won't have to do it on all of your other pages.

If someone else could shed some light on this little oddity, that would be great.  Personally, I think there are still some glitches to work out with master pages.  There is supposed to be a service pack coming out for VS soon.  Maybe that will take care of the issue.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:brettr
ID: 18043076
I'll use the dummy <form> tags on specific pages, since I still use the master's <form> tag in some cases.

Thanks.
0
 
LVL 9

Expert Comment

by:stengelj
ID: 18043215
You should be able to have the dummy <form>on the master and still be able to use the "official" master's <form> tag.  The runat="server" should trump the dummy <form> tag for any of your server-side stuff, but I can understand wanting to keep the workarounds on their respective pages.

Thanks for the points and good luck with your project!
0
 

Author Comment

by:brettr
ID: 18046171
You're welcome.  I've put up another post you might be interested in: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_22077883.html.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
imap mails 1 25
transaction in asp.net, sql server 6 43
Finding Events logs for IIS website that restarts 2 14
Testing of the web services 1 35
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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