问题描述
Hello All
我从页面后面的代码中删除了命名空间
这个名字我已删除的空间显示在此
然后页面后面的代码变成这样:
,我的页面内部使用过的控件出现问题并显示错误:控件在当前上下文中不存在。
代码来源页面就像在这个链接:
如何解决这个问题,因为我不想使用命名空间,因为我正在关注视频教程并且他们没有使用它。
我是什么尝试过:
我是初学者,不知道该怎么办
Hello All
after i removed the namespace from the code behind the page
the name space which i have removed is shown in this screenshoot
then the code behind the page became like this : screenshoot
, i got issue with used controls inside my page and showing the error : the control is not exist in the current context.
the code source of the page is like in this link : screen shoot
how to solve this as i dont want to use the namespace because im following a video tutorial and they are not using it.
What I have tried:
im beginner and didnt know what to do
推荐答案
public partial class webform2 : System.Web.UI.Page
关键点是单词 partial ,表示类定义的某些部分存在于另一个文件中,该文件仍然具有名称空间宣言。除非你真的理解所有部分是如何组合在一起的,否则最好不要尝试改变它。
The key point being the word partial which indicates that some part of the class definition exists in another file, which will still have the namespace declaration. Unless you really understand how all the pieces fit together it is best not to try changing it.
这篇关于当前上下文中不存在控件? ! !的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!