473,666 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to manage solutions that don't fit within the ASP.NET page lifecycle

I'm new to ASP.NET and have run across a problem several times while
working on web apps. I often need to create content dynamically (based
on an event) which contains dynamically created linkbuttons (or other
webcontrols). These linkbuttons have to be created after events are
processed, and so these linkbuttons cannot have handlers added to them
because they are too late in the page lifecycle for the handlers to
register.

An example:

I have a page that displays the results of a database query. The query
is generated by an interface at the top of the page. The bottom of the
page shows the results of that query. Next to each result is a
linkbutton that allows you to delete that item from the database.

The lower part of the page needs to be generated after the event
handlers for the query interface are fired. This means that the lower
part of the page is created too late in the page lifecycle to attach
eventhandlers to included linkbuttons.

I've kludged around it by using regular HTML instead of linkbuttons
and creating an href javascript calling dopostback - then in my
pageload looking at the POST variables and figuring out what was
clicked.

This works, but because it is accessing parts of ASP.NET that aren't
meant to be accessed directly, I'm afraid it will break in future
versions or on newer browsers.

Ideally, I'd like to be able to refresh the page via a postback - so
that page state and the scroll position is maintained and only the
page lifecycle is rerun.

How are other people handling issues like this?

Regards,
Epson
Nov 18 '05 #1
0 1011

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

Similar topics

1
1001
by: Epson Barnett | last post by:
I'm new to ASP.NET and have run across a problem several times while working on web apps. I often need to create content dynamically (based on an event) which contains dynamically created linkbuttons (or other webcontrols). These linkbuttons have to be created after events are processed, and so these linkbuttons cannot have handlers added to them because they are too late in the page lifecycle for the handlers to register. An example:
2
3169
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
2
4816
by: Frankie | last post by:
I have a user control into which I insert a bunch of controls dynamically. I have it all working just fine - Everything is there on Postback, etc. I load this user control into a hosting ASPX page at runtime during the Page_Load event procedure of the hosting ASPX page. Question: Would it be better to load the user control from the hosting page's OnInit event rather than Page_Load? Does it matter or not? I ask because I understand...
4
2060
by: Jeremy Holt | last post by:
Hi, In a windows.forms application I would BeginInvoke a delegate on the UI thread to collect data from a database. When the call returns to the AsyncCallback, if the Control.InvokeRequired = True, I would then have the Control.BeginInvoke(New AsyncCallback(AddressOf GetDataCallback), New Object() {ar}). How would one achieve the same thing on an asp.net page (without using a webseervice)? In the code below, because the...
2
1735
by: Diffident | last post by:
Hello All, I have a question which is pertinent to Page's lifecycle. I declared a protected static object (global variable) whose value is set only once when the page is loaded. Will that object's value be accessible during consequent postbacks or is it set to null after HTML is rendered initially? I am assuming that it would be set to null because all the objects are
7
1749
by: | last post by:
I'm using ASP.NET 2.0, C#, SQL Server 2005, and databound controls like the DataList and the GridView. Right now I'm using SqlDataSource as part of very quick and dirty site; I'm not looking to tier things. I want the topmost/first data element in a particular control to NOT be displayed. This should be possible by either telling the renderer to hide the first element programmatically, or by deleting it from the data store that it has...
2
3184
by: Gary W. Smith | last post by:
I have a page that inherits from a base page that is currently overriding all of the On* events. For the most part I'm accomplishing everything I set out to do with the inheritance, but I wanted to get a little more information to lock down what I think I know and also to answer a couple little questions. Given a base page, and the page inheriting it, as I understand it, the page lifecycle flows like this: 1) Page is requested
4
4671
by: Dariusz Tomoñ | last post by:
Hello, How can I manage files from ASP.NET C# 2.0? I mean I would like to save/erase files, find files in a folder and programatically check if the file with the specific name exists in a folder. I tried to google a bit but I could not manage to find any page with technical/practical approach to the problem. Thank you in advance for any help
4
2476
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
8440
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
8352
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
8780
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
8549
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
8636
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...
1
6189
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
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
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
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.