designer.cs在Visual Studio中使用的用户控制问题 [英] designer.cs issues with using user control in Visual Studio

查看:139
本文介绍了designer.cs在Visual Studio中使用的用户控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的发展,我有一个web用户控件项目,将使用用户控件从Web用户控件项目的另一个Web项目。

During my development, I have a web user control project and another web project which will use the user controls from the web user control project.

所以我的DocControl.ascx文件复制到我的web项目,并尝试使用DocControl.ascx的属性。
不过VS不知道控件的属性。所以,当我检查designer.cs,参考就是这样

So I copy the DocControl.ascx file to my web project and try to use the properties of the DocControl.ascx. But VS does not know the properties of the control. So when I check the designer.cs, the reference is like that

protected global::System.Web.UI.UserControl Control;

这应该是

protected global::MSN.DocControl Control;

所以,我从 System.Web.UI.UserControl 改变控件的名称为 MSN.DocControl ,我可以用DocControl.ascx的属性。

So I changed the name of the control from System.Web.UI.UserControl to MSN.DocControl and I can use the properties of the DocControl.ascx.

但我的问题是,每当我修改(例如把拉布勒在ASPX)ASPX文件,在designer.cs参考变得

But my issue is whenever I modify ( eg. put a lable in aspx) the aspx file, the reference in designer.cs become

protected global::System.Web.UI.UserControl Control;

所以我不得不改变它,每当我修改我的aspx。

So I has to change it whenever I modify my aspx.

我应该怎么做,所以我不需要改变designer.cs

What should I do so I don't need to change the designer.cs

在此先感谢......

Thanks in advance......

推荐答案

我已经通过移动解决它

protected global::MSN.DocControl Control;

从designer.cs到.CS页。

所以每当你所做的任何更改,这将是确定。

So whenever you made any changes, it will be OK.

@kokbira - >希望它可以帮助你。

@kokbira - > hope that it helps you.

这篇关于designer.cs在Visual Studio中使用的用户控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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