Another day with AJAX ModalPopupExtender

I reckon that I'll have to face this one day, and here it comes. Recently I tried to find ways to make the ModalPopupExtender to be shown dynamically because I foreseen that my current project would require such feature soon, and it came very soon for my boss asking for it.

After some finding, it isn't very hard to implement it, but it's not that straight forward either. I found an example on the net that would require the pop-up to be registered with the JavaScript on the client side, which isn't what I really wanted because I'd prefer code behind since everything has been written behind the code and there's a lot of database related stuff, which I don't really want to expose it on the client side. Plus, I'm not really familiar with registering code behind method with the JavaScript, so I opted not to go down that path.

So how to do it?

First, add in the ModalPopupExtender and the pop-up controls like how I did before. Then, this is the part where I need to do - create a dummy button with style attribute of display = none. After that, assign the ID of that dummy button to the ModalPopupExtender because the target control ID has to be supplied otherwise it would complain. Then, in the code behind, call the Show() function of the ModalPopupExtender object to show the pop-up.

That's it, not that straight forward and not that difficult either.

Comments

Popular posts from this blog

Yahoo! Messenger voice call & video call disabled, why?

Sport's Injuries - Treatment for bruises

Web Development: Disable, Validate, & Enable Buttons