views:

448

answers:

1

Hi, how can i disable a set of controls while waiting for a certain Ajax call to end?

I'm aware of the method:

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(onSubmit);

but this will be triggered for every updatepanel, not only the one I want to control.

Also, an UpdateProgress (maybe with an overlying semitransparent div) is not really disabling.

Maybe there's something in ajaxcontroltoolkit? Thanks

+1  A: 

This function will be executed on the beginRequest event:


function onSubmit (sender, args) {
  var element = args.get_postBackElement();
  // May need more traversing...
  var parentElement = element.parentNode.parentNode;
  $(":input", parentElement).attr("disabled", "disabled");
}

This will disable all the controls inside the parent element.

Note that you need to include the JQuery JavaScript library. I would like to mention that Microsoft supports JQuery, and they will make support for it in upcoming versions of Visual Studio. For more information please visit http://live.visitmix.com/.

knut
i already use jquery in my page. thank you for you suggestion!
pistacchio