RaisePostBackEvent question

K

Karl Hungus

how come RaisePostBackEvent doesn't work correctly if the
IPostBackDataHandler isnt implemented. It seems that I must at least have:

public bool LoadPostData(String postDataKey, NameValueCollection values) {
return false;
}

public void RaisePostDataChangedEvent() {
}


In order for the eventArgument string to come through properly in:

public void RaisePostBackEvent(String eventArgument) {


Anyone know why?

TIA
Karl
 
T

Teemu Keiski

If you have IPostBackDataHandler implemented and you wish
IPostBackEventHandler.RaisePostBackEvent called (means you have implemented
both interfaces), you'd need to use Page.RegisterRequiresRaiseEvent to get
RaisePostBackEvent called . Otherwise it is not called at postback
processing stage.

If this doesn't help, what kind of control it is in question? If it is a
composite one, you'd need to implement INamingContainer interface for
postback data to be routed correctly. Post some more code.


--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


how come RaisePostBackEvent doesn't work correctly if the
IPostBackDataHandler isnt implemented. It seems that I must at least have:

public bool LoadPostData(String postDataKey, NameValueCollection values) {
return false;
}

public void RaisePostDataChangedEvent() {
}


In order for the eventArgument string to come through properly in:

public void RaisePostBackEvent(String eventArgument) {


Anyone know why?

TIA
Karl
 
K

Karl Hungus

Im asking why it doesnt work if you *dont* implement IPostBackDataHandler. I
dont need to do anything with either method of that interface.

If I do not implement that interface, my RaisePostBackEvent is called but
the eventArgument is empty. If I do implement it, just in a barebones way,
as described below, eventArgument behaves correctly.
 
T

Teemu Keiski

Why I said this is that IPostBackDataHandler implementation (postback data
loading) always overrides IPostBackEventHandler implementation (postback
event raising) unless it, postback event raising, is explicitly done with a
call to Page.RegisterRequiresRaiseEvent in IPostBackDataHandler
implementation. If you don't believe that, get a copy of "Developing ASP.NET
Server Controls and Components" (MSPress) and see yourself

As I said, tell bit more about your control. It is *VERY* hard to guess
without seeing the code (despite what you ask).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top