从父页按钮单击事件设置用户控件的字符串属性不起作用 [英] Setting a string property of user control from parent page button click event not working

查看:55
本文介绍了从父页按钮单击事件设置用户控件的字符串属性不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用户控件ProfileSetup.ascx,其属性为

I have a user control ProfileSetup.ascx with property

[DefaultValue("")]
        public virtual string Name{ get; set; }





用户控件在HomePage.aspx中显示为模式弹出窗口





The user control is shown in HomePage.aspx as a modal popup

<als:Panel ID="pnlProfilePopup" Style="display: none;" Width="100%" runat="server">
            <cgf:CustomProfile ID="ccProfileSetup" runat="server" />
        </als:Panel>







在HomePage.aspx中有一个配置文件按钮



点击配置文件按钮我设置了用户控件的属性




In HomePage.aspx there a "Profile" button

on click of "Profile" button I set the property of user control

ccProfileSetup.Name = "ABC";
myModalPopup.show();







但是当弹出窗口打开Name属性时null或



请提供解决方案。当我从aspx执行它时它工作






but when the popup opens the Name property is null or ""

Please provide a solution. when i do it from aspx it works

<als:Panel ID="pnlProfilePopup" Style="display: none;" Width="100%"  runat="server">
            <cgf:CustomProfile ID="ccProfileSetup"  runat="server" Name="ABC" />
        </als:Panel>





是否可以通过代码隐藏事件来完成?



can it be done from code behind event?

推荐答案

试试这个..





try this..


 myModalPopup.show();
ccProfileSetup.Name = "ABC";





首先调用show()方法,然后将属性值设为..



call the show() method first and then asign the property value..


这篇关于从父页按钮单击事件设置用户控件的字符串属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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