Solved

Master page and HTML FORM tag?

Posted on 2006-11-29
6
1,752 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

785 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