如何使用内容页面中的控件更新母版中的面板 [英] how to update panel in masterpage using control in content page

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

问题描述

嗨朋友

我在母版页中有一个更新面板

< asp:UpdatePanel ID ="UpdatePanel1" runat ="server">
< ContentTemplate>
< asp:Label ID ="cartnum" runat ="server"> 0</asp:Label>物品
</ContentTemplate>

</asp:UpdatePanel>

我必须从内容页面控制此更新面板
怎么办?
请帮助我

解决方案



创建面板的属性并将其公开.

或使用this.Master查找控件.

标签lbl =(标签) .Master.FindControl("  Cartnum");
lbl.Text = " ; 


将此代码写在内容页面上;

标签l =(标签)Master.FindControl(" ) 作为标签;
                l.Text = " ; 


hi friends

i have a update panel in master page

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="cartnum" runat="server">0</asp:Label> Items
</ContentTemplate>

</asp:UpdatePanel>

i have to control this update panel from content page
how to do?
please help me

解决方案

Hi,

Create property of panel and expose them.

Or find the control with this.Master.

Label lbl = (Label)this.Master.FindControl("cartnum");
lbl.Text = "message";


Write this code on content page;

Label l = (Label)Master.FindControl("cartnum") as Label;
                l.Text = "123";


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

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