0

I have an update panel with a runat server div inside, this div isn't shown in the first load of the page. I used to show it after user input the search key then reload the update panel which contain the div and fill div controls then show it.

I have a CheckBox inside this div tag and I need to get the click event of this check box with jquery

I try to use direct .click or .live but all doesn't work !!

Any help will be appreciated.

2
  • post an example on jsfiddle.net or at least post your code Commented Jul 18, 2011 at 9:47
  • I use this way and it works // Set a deleget for updatepanel load $("#MyUpdatePanelID").ready(function () { if (Sys) Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoadedHandler); }); // Method which will be called when updatepanel loaded function PageLoadedHandler(sender, args) { if (sender._postBackSettings) { $("input:checkbox").click(function () { alert('Any code'); }); } } I'm not sure if it's the best Commented Jul 18, 2011 at 9:53

2 Answers 2

1

Use this code

    $(document).ready(function()
    {
    //This will add one function to be called on every request of the update panel
     Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    });

    function EndRequestHandler()
    {
    $('#checkboxID').change(function(){
    //Your functionality
    });

}
Sign up to request clarification or add additional context in comments.

Comments

1

You need to introduce javascript into the page to simulate the click event again. Page.RegisterClientScriptBlock or Page.RegisterStartUpScript should do it.

or place this inside the updatepanel

 <script type="text/javascript">
  Sys.Application.add_load(your jquery function);
 </script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.