I have a Base MasterPage class, from which my masterpages will inherit. I have some javascript functions there for it’s child pages to include. As it’s a base class, it does not have a visual designer nor I can add XHTML code.
I need to add a hidden field to the class so I can set it’s value in the javascript code, and when a postback occurs I can get the setted value on my content pages.
Yet I fail to achieve this, for when I try to add the hidden field to the base masterpage’s control collection I get a render error (Content Encoding error if viewed in Firefox). And If I try cheating and registering a hidden field via scriptmanager with the same name in stead of adding the control to the control collection, well… I get the value as empty.
How could achieve this?
I have a Base MasterPage class, from which my masterpages will inherit. I have
Share
You can access the HiddenField’s value via
Request.Form("MyHiddenField1")(since it’s not a servercontrol, it isn’t part of the page’s control-collection).MSDN: HttpRequest.Form-Property