Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

designer.cs issues with using user control in Visual Studio

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.

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;

Which should be

protected global::MSN.DocControl Control;

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.

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;

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

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

Thanks in advance......

like image 204
kevin Avatar asked Oct 09 '22 03:10

kevin


1 Answers

I have solved it by moving

protected global::MSN.DocControl Control;

from designer.cs to .cs page.

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

@kokbira - > hope that it helps you.

like image 92
kevin Avatar answered Oct 13 '22 10:10

kevin