如何从控件访问视图 [英] How to access the view from control

查看:87
本文介绍了如何从控件访问视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在view.aspx文件中设计了一个botton,其ID名称为abutton,我想从ControlModel.css中访问abutton.该变量在此类中不可见.在controlModel.css中,我什至无法创建可以使用abutton的view.aspx.cs新对象.

A botton is designed in the view.aspx file and the id name is abutton I wanna access the abutton from the ControlModel.css . The variable is not visible in this class.In controlModel.css I''m not even able to make a new object of view.aspx.cs where the abutton is available.

推荐答案

您永远不必这样做,因为它会破坏使用MVC的目的.在视图类而不是控制器类中处理UI内容.
You should never have to do this as it defeats the point of using MVC. Handle the UI stuff in your view-class and not in your controller-class.


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

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