我想从class.cs访问Default.aspx的控件 [英] I want access cotrols of Default.aspx from class.cs

查看:56
本文介绍了我想从class.cs访问Default.aspx的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Default.aspx页面的ContentPlaceHolder中具有标签,文本框等控件. 我想通过函数或
从AppCode文件夹中的Class.cs访问相同的控件 是否可以将Default.aspx页面作为参数传递?

I have controls like Label ,Text Box etc inside ContentPlaceHolder in Default.aspx page
I want to access same control from Class.cs inside AppCode folder through functions or
Can I pass Default.aspx Page as parameter?

推荐答案

为什么?您只是在破坏整个抽象概念.首先,如果没有某种事件/代码,您将不会进入Class.cs.为什么需要从Class.cs访问控件.让Class.cs执行所需的逻辑,并处理Default.cs上所有控件相关的功能.
why? you simply are breaking the whole notion of abstraction. First of all, you will not get into Class.cs with out some sort of event/code. Why do you need to access the controls from Class.cs. Let Class.cs do whatever logic you need to do and handle all control related functionality on from Default.cs


正如其他人所说,您要做的是堕胎.您需要修复您的设计.您可以使用"this"来传递页面,但同样,这太可怕了,我会当场解雇所有这样做的人,因为我觉得他们对基本元素的理解软件设计方面的内容太过遥不可及.
AS someone else said, what you want to do is an abortion. You need to fix your design. You COULD pass your page through, using ''this'', but, again, it''s horrible, I''d fire anyone who did that, on the spot, because I''d feel that their understanding of basic elements of software design were too far gone to be redeemed.


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

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