![](/img/trans.png)
[英]How to programmatically access a control on a aspx page from the cs file
[英]How to access controls from aspx file in other .cs files
我有一个写控件的aspx文件。 我想在.cs文件中访问这些控件,该文件不是此aspx文件的代码,而是另一个类文件。
例如:我想从另一个.cs文件更新UpdatePanel。
我怎样才能做到这一点?
只需将其作为参数传递给另一个类文件中的方法。 就像是:
public class OtherClassFile
{
public static void UpdateMethod(UpdatePanel panel)
{
//Update the panel here
}
}
然后,.aspx页中的methdod调用将如下所示:
OtherClassFile.UpdateMethod(MyUpdatePanel);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.