how do I rebind a jquery function to contols in a asp.NET updatepanel after a callback updating that updatpanel has been done?

how do I rebind a jquery function to contols in a asp.NET updatepanel after a callback updating that updatpanel has been done?

First of all, i am not a big fan of asp.net(maybe because I kind of suck on it) but I work with it at the moment.
using:
VS 2005 .Net framework 2.0..something
ajax control toolkit


I have a updatepanel which contains of a few dynamically created controls ( ImageButtons that are placed in a panel inside the updatepanel)

Since the imagebuttons are children of the updatepanel they automatically triggers a callback to server, fine.

But I want the user to be able to cancel the callback after clicking on any control un the updatepanel, preferably through a javascript window.confirm.


I have done it with a jquery function returning false (i dont know why it works, dont really understand asp.net ajax functionality) but it only works until a callback is done,
then I guess I have to rebind the jquery to the controls in the updatepanel because it has been reloaded or?

How do I rebind the recently loaded controls in my updatepanel to my jqyery function?

the controls all have the same class and I use that to trigger the jquery function.

aspx file
..
..
$('.myImgButtons').click(function(){     

  if(window.confirm('Cancel callback?') )
     return false;
});
..
..

<asp:UpdatePanel .....  >
  <ContentTemplate>
    <asp:panel id="myPanel" ........  ></asp:Panel>
  </ContentTemplate>
  <Triggers>           
     ..whatever..
  </Triggers>
</asp:UpdatePanel>


aspx.cs file

..
..
for(..blabla..)
{
      ImageButton dyn_ImgButton = new ImageButton();
      dyn_ImgButton.Attributes.Add("class", "myImgButtons");
      add dyn_ImgButton to myPanel
}
..
..

thanks in advance!






















































    • Topic Participants

    • lars