This is a migrated thread and some comments may be shown as answers.

ascx.designer.cs (or .vb)

1 Answer 179 Views
Getting started with ASP.NET
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 2
Jim asked on 26 May 2009, 04:38 PM
Perhaps this thread does not belong on the telerik site, as it is not an issue or concern with their product.  Just the same, I have run into an annoying problem and would appriciate any advice.
I am using telerik ASP.NET Ajax controls to build DNN modules.  By preference I use the WAP model for developing these modules.  Please keep in mind that I am an old C++ developer and am fairly new to ASP.NET, C#, and User Controls.  Regardless of my lack of experience,  I am able to create these modules using Rad Controls.   I have one issue.  I always receive a build error, Error 1 The type 'System.Web.UI.IScriptControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. ....
The auto generated file, *.ascx.designer.cs  contains declarations of Rad controls that are not found.  I have been simply deleting these from the ascx.designer file and it then compiles without error.   In addition, they run without problem.

My concern is I am deleting things without knowing fully their purpose.  This leads my to ask the following question.
1) What is the purpose of the ascx.designer files
2) What do I need to change so that when this is generated, rad controls are found in the assbly

1 Answer, 1 is accepted

Sort by
0
Jim
Top achievements
Rank 2
answered on 27 May 2009, 11:51 AM
Just an update in case anyone else runs into a similar problem.   I belive the issue has to do with WAP and my lack of understanding of how to reference the site's web.config.  Playing with the same code using WSP, I did not run into the problem.  I went back to a WAP project and looked for settings in Visual Studios that would take care of the problem.  Im sure my falilure to do so was a result of my lack of experience in this environment.  Regardless,  I was able to solve my problem.   When I originally created the WAP project, a web.config was created in the project directory.  Being a DNN module this was placed in the coresponding directory under DesktopModules.  This caused problems when using the control in the site.  The information I was able to retrieve indicated I should simply delete the web.config created in the project folder.  Doing this solved my runtime error.  What I did to solve the issue that prompted me to create this thread was to copy the site's web.config under the project folder.   This solved the problem.   Now what is interesting, and leaves me a little puzzled, is I subsequently removed the copy of the web.config from the project folder, expecting to see the error mainfest upon the next build.  It did not.  This tells me by placing it there temporarily Visual Studios was able to set some yet unknown properties that remained after I removed the web.config.

BTW:   I do see now that the ascx.designer somehow relates components from the ascx to the code behind ascx.cs.  Before I took the above mentioned steps, I tried referencing the control in the code behind.  The reference caused the same error I reported, and as would be expected, if I removed it completely I could not access the control in the codebehind.

The moral of the story is if you are using WAP for user control development, and you lack the experience to setup the environment correctly, and as a result you are getting a build error, "Error 1 The type 'System.Web.UI.IScriptControl' is defined ....." then do what I did and it appears to fix the problem
Tags
Getting started with ASP.NET
Asked by
Jim
Top achievements
Rank 2
Answers by
Jim
Top achievements
Rank 2
Share this question
or