LinkButtons needs to be clicked twice to fire the event

Discussion in 'ASP .Net' started by Author #1, Jun 2, 2009.

  1. Author #1

    Author #1 Guest

    LinkButtons needs to be clicked twice to fire the event

    I have been bothered by this problem for a long time, but haven't
    really found a solution. I also could not google out articles about
    this. I doubt I am the only one who's had this kind of problem. This
    problem seems to happen only if I ajax my controls.

    The problem:

    In my AJAXed asp.net 3.5 web application, I have a web form which
    loads a few user controls dynamically. These user controls have some
    LinkButtons. I notice that I sometimes I have to click on such link
    buttons twice to fire the click event. I say sometimes, because I am
    not sure about the pattern yet, but it seems that this happens after I
    edit or delete something and rebind/reload my controls.

    Because these user controls are dynamically added and their event
    handlers are also wired dynamically in code-behind like this:

    myUserControl.MyLinkButtonGetsClicked += new EventHandler
    (myUserControl_MyLinkButtonGetsClicked );

    I am suspecting that somehow, maybe due to ajax, the first click
    causes a postback, during which the event handler gets wired up, but
    the the event handler, i.e., myUserControl_MyLinkButtonGetsClicked,
    does not get executed. The event handler gets executed the 2nd time
    the Link Button is clicked.

    Does this guess sound reasonable? If yes, how to shoot this problem?
    Any article out there? Thanks.

    I am aware that this may not be clear since I don't have code snippet
    here. But just in case that you guys have had such problems.

    If there is a need, I will follow up with the code snippets.
     
    Author #1, Jun 2, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    7,573
  2. =?Utf-8?B?QmFkaXM=?=

    Clicking twice to fire an event

    =?Utf-8?B?QmFkaXM=?=, Apr 3, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    314
    Ben Rush
    Apr 3, 2007
  3. dilbert
    Replies:
    0
    Views:
    470
    dilbert
    Jan 28, 2008
  4. dilbert
    Replies:
    0
    Views:
    454
    dilbert
    Jan 28, 2008
  5. Replies:
    0
    Views:
    340
Loading...

Share This Page