473,513 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASCX designer file not linking - nest related files

Hi all,

ASP.NET : Framework 2.0 - C#

A recent addition to my code generater will create GridView's and
ObjectDataSource's in a control (ASCX).
So the code gen creates an ascx, ascx.cs, ascx.designer.cs and a
stylesheet.
The 3 control files are placed together.

When generating for project A, the control files (after refresh)
appear all nested properly, eg.
+ TestGrid.ascx
- TestGrid.ascx.cs
- TestGrid.ascx.desginer.cs

... and compiles nicely and works perfectly.

I now wanted to use it for another project (B), but when refreshing
the files in the website, only the .ascx.cs file nests under the .ascx
file. The designer file does not nest; it simply sits at the same
level as the ascx. Clicking "nest related files" over and over makes
no difference.

Project B also does not build. The error is as follows (where UserGrid
is the name of the control):
"Could not load type: 'ICMWeb.UserGrid'
.... and this error occurs on line 1 of the ASCX file (the @
directive). THe code behind file is correct, and the inherits
attribute is also correct.

This error naturally occurs for every control I generate.
Also, when I delete ALL asp code from the .ascx file except for the
directive, it still fails.

So I suspect that the 2 issues are related: the fact that VS doesn't
think that the designer file is the same as the .ascx.cs file (even
though they are both partial classes and have the same name) and the
fact that it can't compile because of a problem with the type
(whatever that means).

Any suggestions?
Does anyone know the criteria that VS uses to nest related files? This
could lead in to identifying the problem.
Also, what's happening with namespaces here? When I create a new site,
pages I add are not namespaced, but the controls I generated ARE
namespaced. Web sites in 2.0 don't let you specify a default
namespace. This could also be related. However, the namespace for the
designer, ascx, and ascx.cs files are all the same.

Any help is appreciated.

Thanks,
Steven

Feb 11 '07 #1
3 5261
Are you using the same project types all around? Keep in mind, there are 2
project types for ASP.Net, the Web Site project that came originally with
VS.Net 2005, and the new Web Application project, which is a port of the VS
2002/3 Web Applicaiton project and available in VS.Net Service Pack 1. Web
Application projects nest files in the exact manner you describe. The
designer and code behind pages are a function of the root aspx page so the
designer is not a function of the code behind and thus appears at the same
level.

When do you receive the error regarding ICMWeb.UserGrid, is it during the
build process, or when you attempt to view the page after a build. If you
are viewing the page after a build and getting this error it is exactly
correct. The error occurs because something within that page is preventing
it from building. You may want to add the Output window to the project as it
will often show errors in the build process that you may now catch
otherwise.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Steven Nagy" <le*********@hotmail.comwrote in message
news:11**********************@l53g2000cwa.googlegr oups.com...
Hi all,

ASP.NET : Framework 2.0 - C#

A recent addition to my code generater will create GridView's and
ObjectDataSource's in a control (ASCX).
So the code gen creates an ascx, ascx.cs, ascx.designer.cs and a
stylesheet.
The 3 control files are placed together.

When generating for project A, the control files (after refresh)
appear all nested properly, eg.
+ TestGrid.ascx
- TestGrid.ascx.cs
- TestGrid.ascx.desginer.cs

.. and compiles nicely and works perfectly.

I now wanted to use it for another project (B), but when refreshing
the files in the website, only the .ascx.cs file nests under the .ascx
file. The designer file does not nest; it simply sits at the same
level as the ascx. Clicking "nest related files" over and over makes
no difference.

Project B also does not build. The error is as follows (where UserGrid
is the name of the control):
"Could not load type: 'ICMWeb.UserGrid'
... and this error occurs on line 1 of the ASCX file (the @
directive). THe code behind file is correct, and the inherits
attribute is also correct.

This error naturally occurs for every control I generate.
Also, when I delete ALL asp code from the .ascx file except for the
directive, it still fails.

So I suspect that the 2 issues are related: the fact that VS doesn't
think that the designer file is the same as the .ascx.cs file (even
though they are both partial classes and have the same name) and the
fact that it can't compile because of a problem with the type
(whatever that means).

Any suggestions?
Does anyone know the criteria that VS uses to nest related files? This
could lead in to identifying the problem.
Also, what's happening with namespaces here? When I create a new site,
pages I add are not namespaced, but the controls I generated ARE
namespaced. Web sites in 2.0 don't let you specify a default
namespace. This could also be related. However, the namespace for the
designer, ascx, and ascx.cs files are all the same.

Any help is appreciated.

Thanks,
Steven

Feb 11 '07 #2
Hi Mark,

It is definately a web site. Although I do have the web app template
installed, I am not using it.
Also, this error occurs during build. I found this funny because I am
not use to build errors occuring on ASPX or ASCX files.

Further investigation shows this. I added a new web control to my
project. This file obviously does not cause any errors during build.
Secondly, I stripped back one of MY offending ASCX files so that it
only had its directive, and 1 code behind file, which only had the the
Load method, exactly the same as the new control. The two controls are
IDENTICAL except for their class names. Still I get the error.

So next I deleted all other files in the project so that there is only
1 offending control, stripped down with nothing in it, and the new
control I added that works fine.
Still I get this error.

So now I am thinking it must be some sort of caching issue. Output
window doesn't reveal anything other than this:
E:\Work\Projects\Internet Connection Monitor\ICMWeb\Controls\Grids
\SettingGrid.ascx(1): Build (web): Could not load type 'SettingGrid'.

This is the code for the control:
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="SettingGrid.ascx.cs" Inherits="SettingGrid" %>

This is the code for the code behind file:
public partial class SettingGrid : System.Web.UI.UserControl { }

Not sure what else to try.
Any more ideas?

Thanks,
Steven

Feb 11 '07 #3
Any further ideas anyone?

Feb 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2133
by: kbailey | last post by:
what a waste of money. visual studio does not handle user control files - these are files with and ascx extension are are refered to in the help as 'user-authored server controls'. the VS...
1
1211
by: Rob Meade | last post by:
Hi all, Still very new to ASP.Net so please bare with me. I have created several .ascx controls which I have dragged and dropped onto my page in a table, looks very nice - each of the controls...
2
1803
by: Holger (David) Wagner | last post by:
Hi all, I'd like to have several "skins" for an application that are "structurally different" (i.e. controls at different locations, some controls visible only in a particular "skin"). The...
7
4478
by: Holger (David) Wagner | last post by:
Hi Group, I've searched the Web for precompilers that compile ASPX/ASCX pages just like it can be done with JSPs, but so far, I've only found approaches targetted at increasing the performance....
4
6857
by: Gopalan | last post by:
Hi I want to use the <link href="...." type="..."> tag inside the .aspx file. This style is used by the user control (converting an existing aspx file to ascx file) which are added to this aspx...
5
3273
by: James | last post by:
When using 2005 I create a new Form and VS displays the .Designer file below the main .cs file at the same level as the resx file. But, if I manually create a MyFom.cs file and a...
1
2182
by: Nathan Sokalski | last post by:
Visual Studio 2005 recently stopped generating the *.designer.vb files for my *.aspx and *.ascx files. I am using Service Pack 1, and do not believe I did anything differently than normal prior to...
0
1401
by: Nathan Sokalski | last post by:
I have several UserControls (*.ascx files) that I register in my Web.config file under the <system.web><pages><controlselement. If I mistype the src attribute in the Web.config file, the pages that...
2
5528
by: royend | last post by:
How may I include a .ascx-file into my C#-file? I have read somewhere that the usual include is no longer supported for ASP.NET C#, but is there someway around this? The file to be included is...
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.