如何从母版页调用内容页面功能 [英] How to call content Page function from Master Page

查看:105
本文介绍了如何从母版页调用内容页面功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有必要从母版页调用内容页的功能。
请让我知道,如果需要更多的数据。



MasterPage.master.cs看起来像

 保护无效Required_Function(对象发件人,EventArgs五)

{
//从内容页
调用Update_Content_Page()}

Default.aspx的样子

  <%@页标题=LANGUAGE =C#的MasterPageFile =〜/ MasterPage.masterAutoEventWireup =真的CodeFile =Default.aspx.cs继承=_默认%GT; 
< ASP:内容ID =内容1ContentPlaceHolderID =的ContentPlaceHolder=服务器>

< ASP:标签ID =Label1的=服务器文本=标签>你好的人< / ASP:标签>

< / ASP:内容>



Default.aspx.cs看起来像

 公共部分类_Default>:System.Web.UI.Page 
{
保护无效Update_Content_Page()
{
Label1.Text =Hello World的;
}
}


解决方案

下面是您的要求教程:



从母版页



的内容页面交互

我不ŧ贴在这里确切的代码,因为该解决方案是相当复杂的。


It is necessary to call content Page function from Master Page. Please let me know if more data needed.

MasterPage.master.cs looks like

 protected void Required_Function(object sender, EventArgs e)
 {
    // call Update_Content_Page() from content page 
 }

Default.aspx looks like

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="contentPlaceHolder" Runat="Server">

<asp:Label ID="Label1" runat="server" Text="Label">Hello people!</asp:Label>

</asp:Content>

Default.aspx.cs looks like

using…
public partial class _Default : System.Web.UI.Page
{ 
    protected void Update_Content_Page()
    {
        Label1.Text="Hello world";
    }
}

解决方案

Here is a tutorial on your request:

Interacting with the Content Page from the Master Page

I don't paste exact code here since the solution is rather complex.

这篇关于如何从母版页调用内容页面功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆