Tutorial :asp.net - set master page form ID dynamically



Question:

I am working on a site which uses master pages (no big deal), and has a form in the master page.

Currently, the form name in the rendered content is always "aspnetform".

I need to change some of the pages that use this master page, and I need to set the form name to something specific for that page (for SEO reasons).

Is there a simple way to do this, in the pages that use the master page?

NOTE: I'm not changing all of the pages that use the master, so the master page really should not change; no rearchitecture.


Solution:1

This post may help you out, though it seems that there's troubles with Designer mode with this solution.


Solution:2

After some consideration, I decided to remove the usage of the master file from the pages I needed to change. Not ideal, but the easiest solution.

Research which led me to this solution: http://forums.asp.net/t/899152.aspx


Solution:3

You need to override UniqueID in the master page. This is returning aspnetForm by default.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »