Solved

Master page and HTML FORM tag?

Posted on 2006-11-29
6
1,750 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

22 Experts available now in Live!

Get 1:1 Help Now