views:

470

answers:

2

I'm using ASP.NET 3.5 + Ajax Control Toolkit + jQuery (NO MVC yet)
I'm looking for a standard solution for showing a user control (.ascx) as a modal popup (like the Ajax Control Toolkit ModalPopupExtender implementation), where I can pass parameters to it before it opens. Then get some values on closing, and potentially handle events on the server.

I'm currently using a combination of the ModalPopupExtender and update panel to implement this each time I need it. It seems like it takes too much plumbing that has to be created each time.
Before creating my own packaged solution, I'm looking for an existing solution, or for a better pattern to implement this.

A: 

It didn't take me too much time to do this. Let me dig up my own implementation.

EDIT:

In it's simplest form, this is what I used. I could drop this into a UserControl and then drop that in any page I wished to use it.

http://stackoverflow.com/questions/518138/trying-to-self-contain-pop-ups-which-use-the-ajaxtoolkit-modalpopupextender

Not sure if this is the part you're wrestling with though.

Spencer Ruport
A: 

I've always set a hidden field value on clientside. My modalpopups data would have parameters that would come from that hidden field. This works great when you update the updatepanel.

function setfield(v) {
 document.getElementById('<%=HiddenField2.ClientID%>').value = v;

}

But maybe this solution isn't a best-practice.

Eric