473,769 Members | 5,871 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 3322
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
2135
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
1942
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
1983
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
2247
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
3189
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
9423
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
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
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
7409
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
6673
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();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
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

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.