RaisePostBackEvent Not Firing

G

Guest

1) Start a new web application in Visual Studio
2) Drop a CheckBox onto the form and set its AutoPostBack to TRUE
3) In the codebehind, override the RaisePostBackEvent event with:

protected override void RaisePostBackEvent(
IPostBackEventHandler sourceControl, string eventArgument) {
base.RaisePostBackEvent(sourceControl, eventArgument);
}

4) Set a breakpoint in the event handler
5) Run the app and click the CheckBox

The form posts back, but the event handler is not raised. Why? What am I
missing?

What I am really trying to do is capture when the user clicks on a table row
and process information from the row that is clicked. The table rows are
being created dynamically, and I can cause a postback by adding the onclick
Attribute to each <TR> row by using:

row.Attributes.Add("onclick", GetPostBackClientEvent(table,
rowCount.ToString());

But the RaisePostBackEvent does not fire. The above example with a CheckBox
is simpler to demonstrate and I assume does not fire for the same reason I am
missing.

I am trying to capture a click event on a server control that does not have
an click method. I am not creating a custom control but overriding the
RaisePostBackEvent on the Page. Is this possible?

Thanks for any help.
 
J

James Steele

Hi Steve,

Are you implementing the IPostBackDataHandler interface? I pretty sure
you have to.
 
G

Guest

James Steele said:
Are you implementing the IPostBackDataHandler interface? I pretty sure
you have to.

No, I did not implement IPostBackDataHandler, but it does not make any
difference. I added IPostBackDataHandler to my page class and implemented
RaisePostDataChangedEvent and LoadPostData but a neither of them are fired.
I notice that the documentation for this interface assumes yoiur class is a
server control, and since I am trying to tie into the Page itself rather than
a user control, I'm not sure if this interface really applies to what I am
trying to do.

Anyone else? Would sure appreciate some help or leads......
 

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,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top