访问类文件中的ContentPage控件(.cs) [英] Access ContentPage Controls in Class file(.cs)

查看:104
本文介绍了访问类文件中的ContentPage控件(.cs)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问类文件中的内容页面控件?



我通过后面的代码中的页面方法[静态方法]调用.cs类文件的方法contentpage。

Master为null,

内容占位符为null,

如何将此内容占位符的控件转换为.cs类文件>>>>?





实际上我想通过.cs类文件中的方法填充下拉列表,所以只是为了阻止页面发布,''使用页面方法,因此我需要那些控件,任何建议都被赞赏

How to access content page controls in a class file?

I invoked a method of .cs class file through page methods[static method] in code behind of contentpage.
Master is null,
content place holder is null,
How to get the controls of this content place holder into .cs class file>>>>?


Actually I want to fill the drop down list through a method in .cs class file, so just to hinder page post, ''m using page methods, hence I need those controls, any suggestion is appreciated

推荐答案

你永远不应该这样做,因为它打破了逻辑的分离。您应该将控件中的数据传递给cs文件,而不是控件本身。
You should NEVER do this, because it breaks the separation of logic. You should pass data from your controls in to cs files, but not the controls themselves.


这篇关于访问类文件中的ContentPage控件(.cs)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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