Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > My page is not triggering the RaisePostBackEvent() method

Reply
Thread Tools

My page is not triggering the RaisePostBackEvent() method

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      10-11-2007
In my *.aspx.vb file, I override the RaisePostBackEvent() method so that I
can run code during any postback. I know that a postback is occurring
because IsPostBack() returns True, but none of the code in the following is
executed:

Protected Overrides Sub RaisePostBackEvent(ByVal sourceControl As
System.Web.UI.IPostBackEventHandler, ByVal eventArgument As String)
Dim outputwriter As System.IO.StreamWriter =
System.IO.File.AppendText(Server.MapPath("debuggin g.txt"))
outputwriter.WriteLine(String.Format("eventArgumen t={0}; Time={1}",
eventArgument, Date.Now.ToLongTimeString()))
outputwriter.Close()
MyBase.RaisePostBackEvent(sourceControl, eventArgument)
End Sub

Am I doing something wrong here? Is there something else I must do in order
to use the the RaisePostBackEvent() method? Any help would be appreciated.
Thanks.

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      10-11-2007
the RaisePostBackEvent is only called if the control is the one that
caused the postback. its generally used to raise the server OnClick event.

-- bruce (sqlwork.com)

Nathan Sokalski wrote:
> In my *.aspx.vb file, I override the RaisePostBackEvent() method so that
> I can run code during any postback. I know that a postback is occurring
> because IsPostBack() returns True, but none of the code in the following
> is executed:
>
> Protected Overrides Sub RaisePostBackEvent(ByVal sourceControl As
> System.Web.UI.IPostBackEventHandler, ByVal eventArgument As String)
> Dim outputwriter As System.IO.StreamWriter =
> System.IO.File.AppendText(Server.MapPath("debuggin g.txt"))
> outputwriter.WriteLine(String.Format("eventArgumen t={0};
> Time={1}", eventArgument, Date.Now.ToLongTimeString()))
> outputwriter.Close()
> MyBase.RaisePostBackEvent(sourceControl, eventArgument)
> End Sub
>
> Am I doing something wrong here? Is there something else I must do in
> order to use the the RaisePostBackEvent() method? Any help would be
> appreciated. Thanks.

 
Reply With Quote
 
 
 
 
IfThenElse
Guest
Posts: n/a
 
      10-11-2007
See
http://www.velocityreviews.com/forum...-question.html
and

http://dotnetjunkies.com/WebLog/will.../23/56278.aspx

From link above.
"
I enjoy writing web controls. However, the last couple of days I've been
having a lot of trouble with RaisePostBackEvent. Sometimes, no matter how
hard I try, I just can't get RaisePostBackEvent to fire unless I call
Page.RegisterRequiresRaiseEvent(this) in LoadPostData.

Other times my eventArgument parameter in RaisePostBackEvent is null. Even
if it has been specified and looks perfect in HTML. I've then had to resort
to funny code (that checks __EVENTTARGET and __EVENTARGUMENT) to get around
it.

When I have to hack to get something working I'm almost 100% sure that I'm
doing something wrong somewhere. But with this I am really stumped. Maybe my
computer needs a new install.

Update: Problem solved! Page.RegisterRequiresRaiseEvent(this) in
LoadPostData was a very wrong way to solve the problem.

The reason RaisePostBackEvent was not being called was simple - the
framework will only call RaisePostBackEvent on one control. In my case the
wrong control's RaisePostBackEvent was being called. In another custom
control I declared a hidden <input> tag with name set to the UniqueID. This
is usually the way I go about creating a control that implements
IPostBackDataHandler. The framework was getting confused and called
RaisePostBackEvent in the wrong control (even though __EVENTTARGET pointed
to the correct control).

In this case, the other control did not implement IPostBackDataHandler and
shouldn't have included the hidden <input>."





"Nathan Sokalski" <> wrote in message
news:...
> In my *.aspx.vb file, I override the RaisePostBackEvent() method so that I
> can run code during any postback. I know that a postback is occurring
> because IsPostBack() returns True, but none of the code in the following
> is executed:
>
> Protected Overrides Sub RaisePostBackEvent(ByVal sourceControl As
> System.Web.UI.IPostBackEventHandler, ByVal eventArgument As String)
> Dim outputwriter As System.IO.StreamWriter =
> System.IO.File.AppendText(Server.MapPath("debuggin g.txt"))
> outputwriter.WriteLine(String.Format("eventArgumen t={0}; Time={1}",
> eventArgument, Date.Now.ToLongTimeString()))
> outputwriter.Close()
> MyBase.RaisePostBackEvent(sourceControl, eventArgument)
> End Sub
>
> Am I doing something wrong here? Is there something else I must do in
> order to use the the RaisePostBackEvent() method? Any help would be
> appreciated. Thanks.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My page is not triggering the RaisePostBackEvent() method Nathan Sokalski ASP .Net 2 10-11-2007 06:14 PM
CGI: triggering a file download & having a page appear Frank Reiff Ruby 1 07-31-2007 09:43 AM
Triggering MDB from EJB's businnes method GenxLogic Java 1 07-20-2006 06:24 PM
Newbie Question - Master Page triggering validator damiensawyer@yahoo.com.au ASP .Net 1 12-17-2005 11:15 AM
Automatically Filling website page and triggering events =?Utf-8?B?RGFu?= ASP .Net 1 08-10-2004 06:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57