I'm running into a wall with a custom control that gets populated via
asynchronous I/O. Basically, my control takes its datasource and renders
some controls that have events (OnClick). However, there's the well-known
problem of dynamic controls not firing unless they are created during the
page's initialization, so OnPreRender is too late to create any dynamic
controls. That being the case, how can I populate a control asynchronously
(via Page.AddOnPreRe nderCompleteAsy nc) that has events that can get fired? 4 3279
for events to fire on postback, you need to recreate the dynamic controls at
onint. this means you should use a caching scheme to recreate them on
postback. on a render, you can still add controls on prerender fine (as
there are no postback events to manage).
-- bruce (sqlwork.com)
"Keith Patrick" <ri************ *******@nospam. hotmail.com> wrote in message
news:%2******** *******@TK2MSFT NGP14.phx.gbl.. . I'm running into a wall with a custom control that gets populated via asynchronous I/O. Basically, my control takes its datasource and renders some controls that have events (OnClick). However, there's the well-known problem of dynamic controls not firing unless they are created during the page's initialization, so OnPreRender is too late to create any dynamic controls. That being the case, how can I populate a control asynchronously (via Page.AddOnPreRe nderCompleteAsy nc) that has events that can get fired?
Hmm, I can see that working, but it's got some issues that may come up under
heavy usage, performance-wise. In my case, I've got the datasource
retrieval abstracted out to a provider, caching included such that any time
I say GetStuff(), it will be from the *current* file contents (cache updates
with the file), and populated on the first call of a page by any user
asynchronously. The thing that's causing me problems doing that is that I
should have logic in the initialization method that's only called when the
data is cached but I'm calling it asynchronously during pre-render when it's
not (and actually, I'm doing this in a masterpage, so I don't even have
access to an OnInit() as well). Things start getting messy when the
external file is changed after render but before postback; the cache is
flushed by the file watcher, so the postback OnInit will now make a
synchronous call to re-fill the cache, bypassing the page's async path.
What would be ideal is to be able to programmaticall y process postback
events again during the prerender step. I thought I had something along
those lines with Page.RegisterRe quiresRaiseEven t, but I misunderstood the
method and wound up getting the last control created being reported as the
sender. Maybe something like Page.PersistFor PostBack(...), or if the
ViewState would work with them (I tried and it didn't, although I haven't
ruled out that it's possible)
Heh...scratch that part about not having OnInit in a master page. I'd had
it implemented elsewhere, so it wasn't showing up in AutoComplete. I'm
looking at going back to storing viewstate for the control as my solution;
I'd disabled it to reduce pagesize, but I think it would be more correct for
me to store the stripped down structure in viewstate so I have something
that is consistent with what was build on prerender during rebuilding, thus
avoiding the cache coherency issue when the datasource is changed during
usage.
And just to show I can't ever make up my mind, I had an Avalon epiphany and
realized my control, which was merely rendering hierarchical data, is
logically just a TreeView with a very specialized visual tree (instead of
declaratively allowing <Setter Property="Templ ate"/>, though, a WebControl
requires override Render(...))
End result? I'm subclassing TreeView such that I get to use the datasource
stuff MS already built into the infrastructure and let it take care of
repopulating the controls/wiring up events in the right time; I just worry
about defining a datasource the thing can use. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Crowley |
last post by:
I'm having an odd problem with viewstate and a dynamically created control
inside a repeater template.
Basically, I have a repeater setup like this in the aspx:
|
by: Kamal Jeet Singh |
last post by:
Hi Friends !!
I am have facing problem in controlling the dynamically created
controls on web page. The problem Scenario is
Scenario:- My requirement is to load the web user controls on the web
page dynamically. To do this, First I including a web page
(MainPage.aspx) and I made form tag to Runat=Server. I included one
table tag and also made this table Runat=Server side. Second I created
three Web User Controls e.g....
|
by: Kamal Jeet Singh |
last post by:
Hi Friends !!
I am facing problem in controlling the dynamically created
controls on web page. The problem Scenario is
Scenario:- My requirement is to load the web user controls on the web
page dynamically. To do this, First I including a web page
(MainPage.aspx) and I made form tag to Runat=Server. I included one
table tag and also made this table Runat=Server side. Second I created
three Web User Controls e.g. wucCustomerInfo.ascx,
|
by: Chad |
last post by:
I have a problem that I am desperate to understand.
It involves dynamically adding controls to a Table control that is built as a result of performing a database query.
I am not looking to avoid the problem by avoiding the table control or resorting to databound controls that better manage state for me. I hope to understand how to solve the problem by using the Table web control and sticking to the approach of building the table at run...
|
by: Marcus |
last post by:
I have a problem maybe one of you could help me with. I've created a data
entry screen with lots of dynamically-created client-side controls. I
create HTML texboxes client-side by assigning a value to the td.innerHTML
property. The UI is done, and I now want to post back the user's changes
and update my business object in .NET. But when I postback, I can't see any
of my dynamically created HTML controls in VB .NET. How do I make them...
| |
by: phil |
last post by:
I decided to use AddOnPreRenderCompleteAsync to avoid holding on to a
thread pool thread for too long. (I do some webserver I/O etc. during
the page build).
In the beginevent handler I fire up a new thread (not a thread pool
thread, but rather System.Threading.Thread) and within that thread I
do all of my page build. Eventually my endevent handler gets called
and the page completes.
It works perfectly except for one major problem: ...
|
by: Chris |
last post by:
I am dynamically adding a user control to each row in a gridview. The reason
I am doing it dynamically is the user control is different depending on
certain data in the gridview. The gridview contains a placeholder and I add
the control to it, the user control is a formview bound to an object
datsource. This works great until I post back the page and the user control
disappears. What am I doing wrong? Regards, Chris.
Protected Sub...
|
by: mohaaron |
last post by:
I can think of a lot of reasons why this might need to be done but as
far as I can tell it's not possible. I've been looking for a way to
add HtmlTableRows to a table using a button click for a while and it
seems it's not possible because the row that gets added with each
click won't get recreated after a post back. After all the reading it
seems that any dynamically created controls must be created in the
Init event to be recreated after...
|
by: semomaniz |
last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have set text boxes and labels inside the table rows. I then added a button. All of these are done through code.
The problem that i am having is i can get the value from a text box with resides inside the first panel (out side of panel that is...
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |