Results 1 to 6 of 6

Thread: [Resolved] Trouble firing events in code behind of user control

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Cape Town, RSA
    Posts
    11

    [Resolved] Trouble firing events in code behind of user control

    Ahoy

    I am trying to use an asp:linkbutton on a .ascx file (user control), but it does not seem to be firing the click event in the code behind. I have put breakpoints on the first line of the event and in the page load of the user control, but it does not get to any of these. All it does is it postbacks to the server and goes through the page load event of the actual form (.aspx) that the user control is sitting on.

    Any ideas?

    Thanks
    Last edited by muri; Jun 1st, 2005 at 01:56 PM.

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Trouble firing events in code behind of user control

    Quote Originally Posted by muri
    Ahoy

    I am trying to use an asp:linkbutton on a .ascx file (user control), but it does not seem to be firing the click event in the code behind. I have put breakpoints on the first line of the event and in the page load of the user control, but it does not get to any of these. All it does is it postbacks to the server and goes through the page load event of the actual form (.aspx) that the user control is sitting on.

    Any ideas?

    Thanks
    How are you assigning the Click Event to teh LinkButton and how are you handling it?
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Cape Town, RSA
    Posts
    11

    Re: Trouble firing events in code behind of user control

    The following code is placed on the .ascx for the linkbutton's click event



    Private Sub lnkLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkLogin.Click

    'code

    End sub



    ...it just never goes thru this code

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Trouble firing events in code behind of user control

    Hmm that should not happen. Are you sure you are running on "Debug" mode and ASP.Net "Debugging" is enabled?
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: Trouble firing events in code behind of user control

    Make sure you are reloading your controls onto the form after the postback, or else the events for them wont fire. Happened to me

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Cape Town, RSA
    Posts
    11

    Re: [Resolved] Trouble firing events in code behind of user control

    Yeh that was my problem - wasnt reloading the user controls on postback.

    thanks patch

Posting Permissions

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



Click Here to Expand Forum to Full Width