473,750 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Controls

Thank you for any help you can provide.

This is what I have:
index.aspx - contains nothing but a form with runat = server
header.ascx - contains asp image box
welcome.ascx - contains text
footer.ascx - contains text
login.ascx - contains asp/web labels and text boxes.

The index page is simply a container for all the user controls. The
header, footer, and welcome controls are always included. The login
control should only be included if the user has not logged in.

Everything runs perfectly if the login control in not included. When
the login control is included I get an error saying that the control
_ctl1_txtUser must reside between the form tags with runat set to
server. The actual control name is txtUser. I understand why the
name changes. What I don't understand is why it has to be in the form
tag. While investigating, I have read in other threads that controls
on user controls are rendered between the form tags of the parent
object. Can anyone offer any suggestions?
Nov 17 '05 #1
4 3316
Jos
Michael wrote:
Thank you for any help you can provide.

This is what I have:
index.aspx - contains nothing but a form with runat = server
header.ascx - contains asp image box
welcome.ascx - contains text
footer.ascx - contains text
login.ascx - contains asp/web labels and text boxes.

The index page is simply a container for all the user controls. The
header, footer, and welcome controls are always included. The login
control should only be included if the user has not logged in.

Everything runs perfectly if the login control in not included. When
the login control is included I get an error saying that the control
_ctl1_txtUser must reside between the form tags with runat set to
server. The actual control name is txtUser. I understand why the
name changes. What I don't understand is why it has to be in the form
tag. While investigating, I have read in other threads that controls
on user controls are rendered between the form tags of the parent
object. Can anyone offer any suggestions?


Just move the <form runat="server"> and </form> tags in the body
of your index.aspx file, in such a way that the login user control
is included.

--

Jos
Nov 17 '05 #2
Michael,

I am assuming you are using the dynamic loading of the
form. This is where you add controls from the code. If
not completely ignore this post because it will confuse
you and go with the suggestion of Jos.

You should put a panel inside the <form></form> and add
all of your components to it. That way you can assure
that your components are added in the correct location.

Another suggestion (not sure if this one will work, but I
am assuming it will) would be to name your form tag and
add your items to the form tag. This again will assure
that you have you items added inside your form tags.

Something else to consider, You don't have to load these
controls dynamically. You can actually set their
visibility to true or false depending on if you would
like to display them.

I have no proof of this, but I think the dynamic loading
will be quicker because you are not loading all of the
objects every time you load the page. You are only
loading those that you specify based on if the user is
logged in or not.

There is a great example of this in the IBuySpy portal at
http://www.asp.net/Default.aspx?tabindex=5&tabid=42.
This has also evolved into http://dotnetnuke.com

Keith
-----Original Message-----
Thank you for any help you can provide.

This is what I have:
index.aspx - contains nothing but a form with runat = serverheader.ascx - contains asp image box
welcome.ascx - contains text
footer.ascx - contains text
login.ascx - contains asp/web labels and text boxes.

The index page is simply a container for all the user controls. Theheader, footer, and welcome controls are always included. The logincontrol should only be included if the user has not logged in.
Everything runs perfectly if the login control in not included. Whenthe login control is included I get an error saying that the control_ctl1_txtUse r must reside between the form tags with runat set toserver. The actual control name is txtUser. I understand why thename changes. What I don't understand is why it has to be in the formtag. While investigating, I have read in other threads that controlson user controls are rendered between the form tags of the parentobject. Can anyone offer any suggestions?
.

Nov 17 '05 #3
Michael,

If you want to dynamically load the control to the page use a placeholder
control. The placeholder control simply shows where a dynamically loaded
control will appear on the page.

My website, www.aboutfortunate.com, uses a single page for the entire site
and switches it's content by dynamically loading various user controls into
a single placeholder.

If you'd like example code for doing so it's located in the site's code
library. Just click on the code library and then use the search box there to
search for: "dynamicall y load user control" or something similar and you'll
find the example.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Michael" <mi******@ace r-access.com> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
Thank you for any help you can provide.

This is what I have:
index.aspx - contains nothing but a form with runat = server
header.ascx - contains asp image box
welcome.ascx - contains text
footer.ascx - contains text
login.ascx - contains asp/web labels and text boxes.

The index page is simply a container for all the user controls. The
header, footer, and welcome controls are always included. The login
control should only be included if the user has not logged in.

Everything runs perfectly if the login control in not included. When
the login control is included I get an error saying that the control
_ctl1_txtUser must reside between the form tags with runat set to
server. The actual control name is txtUser. I understand why the
name changes. What I don't understand is why it has to be in the form
tag. While investigating, I have read in other threads that controls
on user controls are rendered between the form tags of the parent
object. Can anyone offer any suggestions?

Nov 17 '05 #4
Thank you everyone for your suggestions.

Justin,

This is exactly what I was looking for. I have and index page and the
content (user control) will change with the users selections.

Thank you,
Michael
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message news:<#j******* *******@tk2msft ngp13.phx.gbl>. ..
Michael,

If you want to dynamically load the control to the page use a placeholder
control. The placeholder control simply shows where a dynamically loaded
control will appear on the page.

My website, www.aboutfortunate.com, uses a single page for the entire site
and switches it's content by dynamically loading various user controls into
a single placeholder.

If you'd like example code for doing so it's located in the site's code
library. Just click on the code library and then use the search box there to
search for: "dynamicall y load user control" or something similar and you'll
find the example.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Michael" <mi******@ace r-access.com> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
Thank you for any help you can provide.

This is what I have:
index.aspx - contains nothing but a form with runat = server
header.ascx - contains asp image box
welcome.ascx - contains text
footer.ascx - contains text
login.ascx - contains asp/web labels and text boxes.

The index page is simply a container for all the user controls. The
header, footer, and welcome controls are always included. The login
control should only be included if the user has not logged in.

Everything runs perfectly if the login control in not included. When
the login control is included I get an error saying that the control
_ctl1_txtUser must reside between the form tags with runat set to
server. The actual control name is txtUser. I understand why the
name changes. What I don't understand is why it has to be in the form
tag. While investigating, I have read in other threads that controls
on user controls are rendered between the form tags of the parent
object. Can anyone offer any suggestions?

Nov 17 '05 #5

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

Similar topics

1
2134
by: Robert Howells | last post by:
Perhaps I'm just too new at this to pull it off, or perhaps it's just bad architecture. I'd appreciate some feedback on the the wisdom (or lack thereof) in attempting the following: I'm not new to programming, but I am new to ASP.NET and Web application design in general... loved the concept of user controls and dynamically adding them to a page. So what I wound up with was an application that dynamically loads two user controls directly...
6
3380
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all the usual stuff of recreating the usercontrol in the Page Init event. The 'failure' sequence is as follows: - select web form button to display the user control - select user control button, event fires - select web form button to display...
4
1941
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
2
1979
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
0
1935
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
3
2237
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
1
2245
by: Demetri | last post by:
I'm trying to determine if we want to use panels or user controls for our pages. Our primary concern is performance, page loading and posting speed. To illustrate my question, lets use the Customer Orders scenario: Problem: User needs to view orders and and edit, add, save on one page called Orders.aspx. To begin with the page contains a grid with basic information about an order. The user can click a row to edit or click an "Add"...
8
3186
by: mark.norgate | last post by:
I've run into a few problems trying to use generics for user controls (classes derived from UserControl). I'm using the Web Application model rather than the Web Site model. The first problem I'm having is that the partial class signature in my projectDetails.ascx.cs file looks like this: public partial class ProjectDetailsControl<TEntryServiceProvider: UserControl, INamingContainer where TEntryServiceProvider : IEntryServiceProvider...
3
2795
by: Terry Olsen | last post by:
I'm trying to add a domain user to a local group using the code below: Dim LCL As New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer") Dim DOM As New DirectoryEntry("WinNT://us.ups.com") Dim DOMUSR As DirectoryEntry = DOM.Children.Find("USERID", "user") Dim LCLGRP As DirectoryEntry = LCL.Children.Find("LOCAL_GROUP", "group")
1
4746
by: zeya_bakhtyar | last post by:
Here is the page architecture: Page loads multiple user controls (including nested user controls) dynamically based on parameters provided into place holders. Note: The page only has the logic to load the user controls and subscribe to custom event exposed in the user controls. Scenario: User comes to this page fills the fields generated by multiple user controls and then hits "Save" button in one of the forms.
0
8999
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6803
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3322
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 we have to send another system
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.