Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't see my user control ASP.NET 1.1 1

Status
Not open for further replies.

TipGiver

Programmer
Joined
Sep 1, 2005
Messages
1,863
In the root i have a folder "user controls" and inside the "logincontrol.ascx". I drag it to a web form, and it generates this:

<%@ Register TagPrefix="uc1" TagName="LoginControl" Src="../User%20Controls/LoginControl.ascx" %>
The ".." is because the page that hosts the uc is in a folder at root.

When i load the page (i know that there will be an error cause i cant see th uc1 in design time), i get the error:

Parser Error Message: The file '/mysite/User%20Controls/LoginControl.ascx' does not exist.

I;m stuck.. any help on that?
Thanks
 
Hmm, not too sure, but it might be easier to just try renaming the folder to ("UserControls") so you won't have the space in there, someone else might can answer this though.

Also what happens if you change it to

Src="../User Controls/LoginControl.ascx
 
Hello

I have tried all these. Removing the %20, renaming the folder... etc
:)
 
If you can't find another solution I would create a new folder, then create a new user control. Then copy all of the code from the old user control to the new control (exluding the "Imports" statments and things like that. Then remove all references in the calling .aspx page. Build the project, then add the user control to the .aspx page and build the project again.

Sorry, that's all I've got ;-)
 
Hi jshurst,
this is the last thing i would do... if i can't fix it.

Thanks so far
 
In the structure of your site, is the page located at:

/mysite/myPage.aspx

and the User Control located at:

/mysite/User Controls/LoginControl.ascx

?



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
The root is c:/inetpub/ or
The usercontrol is in /User Controls/LoginControl.ascx

The page is in /default/page.aspx

When i drag it, a gray rectangle appear.. not the one that represents an error with red font color. When i launch the page, it says that it cannot find the source.
 
OK, so just to confirm you have two files:

1) The page which has a local path of "c:\inetpub\
2) The user control which has a local path of "c:\inetpub\ Controls\LoginControl.ascx"

If so, have you tried using:
Code:
Src="~/User Controls/LoginControl.ascx"
or
Code:
Src="~/User%20Controls/LoginControl.ascx"


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
1 and 2 correct.
I had tried these, and now again to be sure. Nothing again! The rectangle i said, say "User Control - LoginControl1
 
I'd say it was a problem either with your solution or User Control the. I've just started a new project and the following line works fine for me:
Code:
<%@ Register Src="../User Controls/LoginControl.ascx" TagName="LoginControl" TagPrefix="uc1" %>
Try creating a simple user control in a new project and see what happens as I can't replicate your error.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I started a new solution with 1 page and 1 uc. The results are the same. So can it be a visual studio problem ?
 
Could be. As I say, I can't replicate the problem so it's either something you are doing wrong or Visual Studio. From the info you've given it doesn't look as though you've done anyything wrong.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I guess i'll have to break into pieces my pc.
I downloaded and installed the sp1 for VS7 and also repaired visual studio... Still the same.
 
Maybe you could copy the full contents of both the page and the user control's HTML portion here (along with the full physical path that you are using for both files). We can then see exactly what you have done.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
The page the will host the uc ( empty:) ):
Code:
<%@ Page Language="vb"  Codebehind="contents.aspx.vb" Inherits="mysite.contents" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title></title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5"[/URL] name="vs_targetSchema">
	</HEAD>
	<body bgColor="#ffffcc" MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
		
		</form>
	</body>
</HTML>

The uc:
Code:
<%@ Control Language="vb" Codebehind="LoginControl.ascx.vb" Inherits="mysite.LoginControl" TargetSchema="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5"[/URL] %>
<body MS_POSITIONING="GridLayout">
	<asp:Label id="UserNameLabel" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 0px"
		runat="server">User Name:</asp:Label>
	<asp:Label id="PasswordLabel" style="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 32px"
		runat="server">Password:</asp:Label>
	<asp:TextBox id="UserNameTextBox" style="Z-INDEX: 103; LEFT: 96px; POSITION: absolute; TOP: 0px"
		runat="server"></asp:TextBox>
	<asp:TextBox id="PasswordTextBox" style="Z-INDEX: 104; LEFT: 96px; POSITION: absolute; TOP: 32px"
		runat="server" TextMode="Password"></asp:TextBox>
	<asp:Button id="LogInButton" style="Z-INDEX: 105; LEFT: 200px; POSITION: absolute; TOP: 80px"
		runat="server" Text="Log In" Width="69px"></asp:Button>
	<asp:RequiredFieldValidator id="PasswordRequired" style="Z-INDEX: 106; LEFT: 264px; POSITION: absolute; TOP: 40px"
		runat="server" ErrorMessage="Enter your password" ControlToValidate="PasswordTextBox">*</asp:RequiredFieldValidator>
	<asp:RequiredFieldValidator id="UserNameRequired" style="Z-INDEX: 107; LEFT: 264px; POSITION: absolute; TOP: 8px"
		runat="server" ErrorMessage="Enter you user name" ControlToValidate="UserNameTextBox">*</asp:RequiredFieldValidator>
</body>

When i add an instance of the uc:
Code:
<%@ Register TagPrefix="uc1" TagName="LoginControl" Src="../User%20Controls/LoginControl.ascx" %>
 
The first file doesn't have the UC in it (i'm trying to get you to actually create this project rather than just say what you would do so I can see if/where it is going wrong).

Show me an example of the page with the user control implemented (and also post the full physical path of both these files that you have created).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Code:
<%@ Page Language="vb"  Codebehind="contents.aspx.vb" Inherits="tahoe_aspnet.contents" %>
[b]<%@ Register TagPrefix="uc1" TagName="LoginControl" Src="../User%20Controls/LoginControl.ascx" %>[/b]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title></title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5"[/URL] name="vs_targetSchema">
	</HEAD>
	<body bgColor="#ffffcc" MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<uc1:LoginControl id="LoginControl1" runat="server"></uc1:LoginControl>
		</form>
	</body>
</HTML>


UC : c:/inetpub/ controls/loginControl.ascx
PAGE : c:/inetpub/
 
I dont want to mess you with names..
Inherits="tahoe_aspnet.contents" The bold is mysite
 
OK, I get a build error when using the following (although it does show correctly in the designer window):
Code:
<%@ Register TagPrefix="uc1" TagName="LoginControl" Src="../User%20Controls/LoginControl.ascx" %>
But, when I remove the %20 so it looks like the following, it all works OK:
Code:
<%@ Register TagPrefix="uc1" TagName="LoginControl" Src="../User Controls/LoginControl.ascx" %>



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Yes, i do get an error with %20. I removed it and launched the page. The page shows my uc, but i cannot see it in design time.

Any ideas ?

PS: The page will have more controls, and the uc. I choose that page to be shown in a frame and everything is ok. When I am at the designer of that page, the uc is not shown. Just only the rectangle i told you earlier
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top