asp.net - Override ASP Master Page html in a single content page? -


I am using ASP master pages, and I want to add an "onkeypress" event handler to & lt

I will add a public property to the masterpiece, such as bodynetwork . Then set the on-line feature of Body Tag in the masterpages prerender event. The client pages must set this property before the fire of the master's prerender event.

This is the air code because I do not have a project to test. But this should be something like this:

Masterpage markup:

  & lt;% - Route = mark the body tag with "server", and give it an ID Context in code -%> & Lt; Body id = "mainBody" runat = "server" & gt; ... & lt; / Body & gt;  

Masterpage codewind:

  Secure Zero Page_ PreRender (...) {mainBody.Attributes ["onkeypress"] = this.BodyOnKeyPress; } Public string BodyOnKeyPress {Get [Return ViewState ["BodyOnKeyPress"]; } Set {ViewState ["BodyOncation"] = Value; }}  

Comments