开发者

Invoking javascript in child page from master page

Hii,

I have function established in child page, 开发者_运维百科that is using in the childpages. I have to invoke the child page function from the master page. How it is possible in javascript


The master page concept only exists on the server side, when the page arrives at the browser it's just a single page.

So, you just call the function normally.


The two pages are merged into one at runtime, so you should have access to the Child page function from the Master page. Are you implementing the function differently depending on the child page? If not, the function might as well be included on the Matser Page.

You will have to make sure that each child page that uses this master page has this function. Otherwise the call from the master page will error. The easiest way to do that is to include a default ContentPlaceholder on the master page, with a version of the function that does nothing, and then override the contents in the child pages where appropriate. If a child page doesn't include a Content tag for that ComtentPlaceholder, the default script from the master page will be rendered.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜