在用户控件中访问aspx页面中的隐藏控件 [英] Access a hidden control in aspx page in a user control
本文介绍了在用户控件中访问aspx页面中的隐藏控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在aspx页面中有一个隐藏的控件。我想在绑定aspx页面的用户控制页面中获取它的值...请帮助
解决方案
您可以通过以下方式访问您的用户控件隐藏的文件值
var hdn = YourUserControl.FindControl( yourhiddencontrolid);
或者你也可以在你的用户控件中创建一个属性,它会返回你隐藏的文件值......
public string HiddenFiledValue {
get {
return myHiddenFiled.Value;
}
set {
myHiddenFiled.Value = value ;
}
}
并在您的父页面中使用该属性,如下所示......
<预LANG = C#> yourusercontrol.HiddenFiledValue块引用>
你有没有试过这样的,
什么HiddenField Info = this.Page.FindControl(MyHiddenField);
-KR
Hi,
I have a hidden control in a aspx page . I want to get its value in the user control page that binds the aspx page...Please help解决方案your can access your user control hidden filed value by following ways
var hdn = YourUserControl.FindControl("yourhiddencontrolid");
Or you can also create a properties in your user control which is returning your hidden filed value like this...
public string HiddenFiledValue { get{ return myHiddenFiled.Value; } set{ myHiddenFiled.Value = value; } }
and use that property in your parent page like this...
yourusercontrol.HiddenFiledValue
Have you not tried anything like this,
HiddenField Info = this.Page.FindControl("MyHiddenField");
-KR
这篇关于在用户控件中访问aspx页面中的隐藏控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文