Trigger updatepanel from another updatepanel

Last post 07-11-2009 5:20 PM by adeel2. 3 replies.

Sort Posts:

  • Trigger updatepanel from another updatepanel

    07-11-2009, 1:02 PM
    • Member
      1 point Member
    • adeel2
    • Member since 06-20-2009, 11:10 PM
    • Posts 8

    Hi,


    I have a div in updatepanel1 and it acts as a popup with few asp.net controls in it. I am using style="display: none" and style="display: block" to make it appear it as popup. There is a button on div which closes it.


    Now when i click the button to close the div, it triggers an update for updatepanel2 which involves quering database and it takes about 2-3 seconds. What i want is for div to disappear as soon as i close it and update the updatepanel2.  So problem is div doesn't disappear until updatepanel2 is fully updated which is really frustrating.


    Ta


  • Re: Trigger updatepanel from another updatepanel

    07-11-2009, 4:10 PM
    Answer
    • Participant
      1,505 point Participant
    • Ambran
    • Member since 03-18-2009, 2:23 PM
    • Denmark
    • Posts 286

    Try to add OnClientClick event to the Close button, and use a javascript function to close the the div:

    OnClientClick=Javascript:CloseDiv()

    Then in the JS function:

    function CloseDiv() {
        $get('<% div1.ClientID %>').style.display = 'none'
    }

    Amit

    If this post was of any help to you, Mark it as Answer for the benefit of others, Thanks.

    Spread Firefox Firebug - Web Development Evolved
  • Re: Trigger updatepanel from another updatepanel

    07-11-2009, 5:13 PM
    • Member
      1 point Member
    • adeel2
    • Member since 06-20-2009, 11:10 PM
    • Posts 8

    Hi, it worked but as soon as div closes and updatepanel2 gets updated, same div popups again, kind of loop?



  • Re: Trigger updatepanel from another updatepanel

    07-11-2009, 5:20 PM
    • Member
      1 point Member
    • adeel2
    • Member since 06-20-2009, 11:10 PM
    • Posts 8

    As i really need to finish this task, i have come up with a solution to work around.


    What I have done is, i've added a timer and added its tick event as a trigger to updatepanel2. So before i close the div, i set a flag, and enable the timer. In timer, i check the flag, reset it, disable timer again and query the database. Atleast its working.

Page 1 of 1 (4 items)