IPostBackEventHandler becomes greedy

Results 1 to 4 of 4

Thread: IPostBackEventHandler becomes greedy

  1. #1

    Default IPostBackEventHandler becomes greedy

    I have two controls implementing IPostBackEventHandler<BR>The page timer from egghead cafe (reference).<BR>PgTimer : WebControl, IPostBackEventHandler<BR>and a more complex control of my own built on this model.<BR><BR>There is a third control (.ascx) containing form data and a save button.<BR>There is also (4th control) a dropdown list on the page.<BR><BR>With the timer, everything is fine.<BR>When my control implements IPostBackEventHandler, things get a bit strange. The buttons inside the data form work at first, but when I make a selection from the dropdown list (postback) the buttons no longer work.<BR>Debugging shows that myControl&#039;s RaisePostBackEvent is being fired and no button click events even though they get wired up.<BR>Commenting out the //,IPostBackEventHandler interface and everything runs smooth.<BR><BR>Any ideas?<BR>

  2. #2
    Join Date
    Dec 1969

    Default controls not maintaining state

    your controls are not maintaining state.<BR><BR>when coding "by the book," controls maintain state across post-backs.<BR><BR>therefore, look for the place in your code where you are asking asp.net to do something differently. that is where your problem is.<BR><BR>it sounds like you are passing the management of the controls to different subs that are not talking to each other properly.<BR><BR>one suggestion is to make sure that your subs have the proper arguments. for example: My_Sub(Sender As Object, e As EventArgs).<BR><BR>if a sub is not getting the controls&#039; state information in its arguments, it sure isnt going to get it by other means

  3. #3

    Default IPostBackEventHandler not state

    My problem is with IPostBackEventHandler , not with state.<BR><BR>The controls maintain state as they should.<BR>If I do not specify that my control implements IPostBackEventHandler then everything is groovy. When I uncomment it and implement the interface, something goes wrong.<BR>A postback event that should be handled by a button event handler goes to RaisePostBackEvent(string eventArgument) instead.<BR><BR>The timer class example does not cause the same problem, so it is something in myControl. I tried removing code from the control, but it is a long process.<BR><BR>Is there anyone familiar with IPostBackEventHandler?<BR> <BR>public class myControl : WebControl //,IPostBackEventHandler<BR>{<BR>...<BR>}

  4. #4

    Default RE: IPostBackEventHandler not state

    Also implementing IPostBackDataHandler fixes it.<BR><BR>public class myControl : WebControl ,IPostBackDataHandler ,IPostBackEventHandler<BR>{<BR>...<BR>}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts