Monday, April 26, 2010

How set focus to a control in a ModalPopupExtender while loading and hiding?(add_shown & add_hiding ModalPopupExtender Events )

In this topic, I’ll discuss the Client events we usually need while using ModalPopupExtender. The add_shown fires when the ModalPopupExtender had shown and add_hiding fires when the user cancels it by CancelControlID,note that it fires before hiding the modal.


They are useful in many cases, for example may you need to set focus to specific Textbox when the user display the modal, or if you need to reset the controls values inside the Modal after it has been hidden.

You can attach your fucntions  by using the Sys.Application.add_load(functionName)
Note :"functionName" should be the name of the function which is used to initialize the events add_hiding and add_shown of the ModalPopupExtender

Inside the fucntion "functionname" you can attach the your functions to the events like below



Please go through the full expample below to understand the woking of these events better.

No comments:

Post a Comment