473,675 Members | 3,215 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble with sequence of page build.

TPS
Instead of using Hyperlinks and URL / Response.QueryS tring() parameters to
pass state around in my app, I am using LinkButtons with a corresponding
command event and command arguments.

This page has LinkButtons in a menu down the left hand side, that when
clicked causes the main content of the page to change. The main content of
the page has linkbuttons as well. I am having trouble with the linkbuttons
in the maincontent area keeping their associated command event wired
together.

The linkbuttons in the left menu get built in the page load of the initial
load and all subsequent postbacks (these work fine).

When a left menu linkbutton is clicked it causes a postback,

Page_Load()
BuildLeftMenu() is run in page_load

I don't run BuildMainConten t() in the page_load because I don't have the new
TopicID yet.

MyLinkButton_Co mmand() fires next, where I capture the command argument
which tells me the TopicID which I set as a session var and then call
BuildMainConten t()

BuildMainConten t() fires which grabs the TopicID from the Session and builds
the maincontent linkbuttons .

The server returns the page to me and the maincontent linkbuttons exist, but
are not wired to their commandevents. Meaning when I click on them nothing
happens.

*************** *************** *************** ******

Now if I put the BuildMainConten t() in the page_load so it builds in the
postback, everything works okay.

My question is, why aren't the commandevents wired to the linkbuttons, when
I have clearly wired them up in the BuildMainConten t() method?

Thanks.

TPS.
Nov 18 '05 #1
3 1506
Hi TPS,

As for the postback issue on the dynamic controls you mentioned, here are
my understandings:

The Controls added in the "BuildMainConte nt()" method is called in other
controls(built in BuildLeftMenu() in Page_Load)'s post back event ,yes?

That means the maincontent's Linkbutton's postback event handler are wireup
when page processing the postback event rather than before it. So of course
it can 't be fired. And when you move the BuildMainConten t() to Page_Load,
their events will be fired.

In fact, as for dynamically created controls, the following two things
should be noticed:
1.Dynamic control should be created everytime page is requested (both the
intial load and the sequential ....). We recommand that we create and add
them in page's OnInit .(in Page_Load is also ok)

2. If the control need to register postback event handler, the handler
should be wireup before the page processing the postback event.
Generally in Page's Init or Load event.

And here is good tech article which has mentioned the things above. I
believe it'll help on undertanding them:

#Understanding ASP.NET View State
http://msdn.microsoft.com/library/de...us/dnaspp/html
/viewstate.asp
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2
TPS
Steven, thanks for your reply.

I have read for hours and still can't seem to answer my question.

My problem is my LinkButton event handler fires "AFTER" the page has been
built. When the event handler fires, that is where I am getting "TopicID"
from the command arguement. I am using the new TopicID to populate my
LinkButtons, but it is too late because the page has already been built!

Ideas?

Thanks,
TPS


"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:hz******** *****@cpmsftngx a06.phx.gbl...
Hi TPS,

As for the postback issue on the dynamic controls you mentioned, here are
my understandings:

The Controls added in the "BuildMainConte nt()" method is called in other
controls(built in BuildLeftMenu() in Page_Load)'s post back event ,yes?

That means the maincontent's Linkbutton's postback event handler are wireup when page processing the postback event rather than before it. So of course it can 't be fired. And when you move the BuildMainConten t() to Page_Load,
their events will be fired.

In fact, as for dynamically created controls, the following two things
should be noticed:
1.Dynamic control should be created everytime page is requested (both the
intial load and the sequential ....). We recommand that we create and add
them in page's OnInit .(in Page_Load is also ok)

2. If the control need to register postback event handler, the handler
should be wireup before the page processing the postback event.
Generally in Page's Init or Load event.

And here is good tech article which has mentioned the things above. I
believe it'll help on undertanding them:

#Understanding ASP.NET View State
http://msdn.microsoft.com/library/de...us/dnaspp/html /viewstate.asp
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3
Hi TPS,

I've seen for new post discussing on the same problem in this group named
"Can EventHandler fire in Page_PreRender event".

I've posted my reply in the thread. I'd appreciate if you have a look
there.
In addition, if you feel it convenient that we continue to discussing in
one of the two threads, please feel free to followup in either one. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #4

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

Similar topics

2
9081
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any other declaration. An error occurred at , (11, 3). Schema compile error: System.Exception: Schema error ---> System.Xml.Schema.XmlSchemaException: May no
4
2406
by: Jon Poploskie | last post by:
Hello, I have an xsd file that I'm trying to use to validate some xml against. I'm hoping this is a simple problem, but I just don't see it. I get the error "The 'role' element is not declared." when trying to validate this xml: <users> <user id="jon" pwd="pass"> <roles><role>Admin</role></roles> </user>
6
1907
by: Hypo | last post by:
Im relatilvly new to a web programming in general, and here's the situation i have: I have a default page with dynamic content, and one button with onclick code something like this: { // do some processing... Serever.Transfer("second_page.aspx"); // or Response.Redirect("second_page.aspx"); same in
5
3251
by: Eric E | last post by:
Hi, I have a question about sequences. I need a field to have values with no holes in the sequence. However, the values do not need to be in order. My users will draw a number or numbers from the sequence and write to the field. Sometimes, however, these sequence numbers will be discarded (after a transaction is complete), and thus available for use. During the transaction, however, any drawn numbers need to be unavailable. I would...
3
4721
by: kevin | last post by:
Is that even possible? I am creating a web service in .NET to expose some already created .NET programs to other groups. One group is writing the client in PERL, and thus wishes the wsdl schema to not be sequenced. (PERL hashes do not retain order information) First, the w3 specs don't mention the sequence in any detail - its just there in the examples, which makes me wonder if removing the sequence tag is even supportable. Second,...
4
1218
by: cmay | last post by:
I am beginning to wonder if it is not possible to get this working. I am trying to do: <root> <a/> <b/> <c/> </root>
7
2585
by: desktop | last post by:
In the C++ standard page 472 it says that you can construct a std::set in linear time if the constructor gets a sorted sequence of elements. But how is this possible when insert takes logarithmic time? Should the time not be nlgn where n is the number of elements?
1
3683
by: Anan18 | last post by:
Hi there, I revised my sequence class, from the last homework to use a dynamic array to store items, i am getting an error and 4 warnings, i also provided my header file, as well as the implementation file, can someone please help me out hear, my brains are beyond fried now, highly appreciated 1>------ Build started: Project: Assignment3, Configuration: Debug Win32 ------ 1>Compiling... 1>sequence2.cxx...
5
13351
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
8975
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
8872
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
8686
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
7506
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
6381
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
4263
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...
1
2874
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
2129
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1871
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.