473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

ASP And User Controls

Hello,

I have created a User Control within Visual Studio and it contains a
button that allows the user to querry a database. I dynamically add
additional controls to the page based on the number of rows retured inside a
dataset. All works well, but I have noticed that the control is rendered
after the WebForm's load event is fired. This creates duplicate controls in
certain situations. I have been able to prevent this from happening by
placing the code to dynamically render the controls in the "Pre Render"
event. But unfortunately I loose the Control's events.

Is there a way to render the controls in the "Pre Render" event and still
maintain the controls Events?
Or is there a way for the control to load prior to the Load Event of the
WebForm?

(Currently when the Controls (button click event) event is fired, the
WebForm Load Event Fires, then the Controls event - augh) What is wanted is
the Controls Event to Fire, then the WebForm Load Event. Based on the
user's interaction with the control, determines what actions the WebForm
will perform in the Load Event.

Any Suggestions would be greatly appreciated,

Thanks,
Chuck
Nov 18 '05 #1
1 1187
Hi Chuck,

I believe the following .Net SDK article wil help. It details the Control
Execution Lifecycle and all the events that get fired in order:

http://msdn.microsoft.com/library/de...nLifecycle.asp

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Charles A. Lackman" <Ch*****@cet.com> wrote in message
news:#l*************@tk2msftngp13.phx.gbl...
Hello,

I have created a User Control within Visual Studio and it contains a
button that allows the user to querry a database. I dynamically add
additional controls to the page based on the number of rows retured inside a dataset. All works well, but I have noticed that the control is rendered
after the WebForm's load event is fired. This creates duplicate controls in certain situations. I have been able to prevent this from happening by
placing the code to dynamically render the controls in the "Pre Render"
event. But unfortunately I loose the Control's events.

Is there a way to render the controls in the "Pre Render" event and still
maintain the controls Events?
Or is there a way for the control to load prior to the Load Event of the
WebForm?

(Currently when the Controls (button click event) event is fired, the
WebForm Load Event Fires, then the Controls event - augh) What is wanted is the Controls Event to Fire, then the WebForm Load Event. Based on the
user's interaction with the control, determines what actions the WebForm
will perform in the Load Event.

Any Suggestions would be greatly appreciated,

Thanks,
Chuck

Nov 18 '05 #2

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

Similar topics

1
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...
6
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...
4
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...
2
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...
0
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...
3
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...
1
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...
8
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...
3
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...
1
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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,...
0
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
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...
0
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...

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.