如何在内容页面中为主页按钮编写按钮单击事件 [英] How Can I Write Button Click Event For Master Page Buttons In Content Pages

查看:59
本文介绍了如何在内容页面中为主页按钮编写按钮单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用asp.net开发移动应用程序&c#

即时通讯使用母版页

现在我想为内容中的母版页按钮编写按钮点击事件代码页面怎么样?

Plz帮助我

im developing a mobile appln using asp.net & c#
im using a master page
now i want to write button click event code for master page button in content page how can i?
Plz help me

推荐答案

在你的母版页的代码中,将事件处理程序上的protected关键字替换为public。

In your master page's code behind replace the protected keyword on the event handler to public.
public void LinkButton1_Click(object sender, EventArgs e)
{
    //Do Stuff Here
}



在您的内容页面中使用主类型指令


IN your content page use the Master Type Directive

<![CDATA[<%@ MasterType VirtualPath="~/masters/SourcePage.master"" %>]]> 



在内容页面的代码中,调用Master事件处理程序如下


In the code behind for the content page call the Master event handler as follows

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
    this.Master.LinkButton1_Click(sender, e);
}





看到一些关于这一点的好链接。并通过这个你会清楚地了解更多

与内容页面进行交互 - 来自主页面-cs [ ^ ]


这篇关于如何在内容页面中为主页按钮编写按钮单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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