The modalpopupextender kicks ass. I have a gridview I'm making for my other day job. It displays hotel rooms in a multi-room reservation. Each row is a room. When you click "view preferences" for each room, it launches the modal popup and tells you whether its smoking or non-smoking, what type of bed (king, queen, or 2 doubles) and so on. You can request changes with the button assigned to OKControlID and cancel with the button assigned to CancelControlID. I ran into a bit of a stumbling block because I wanted to have multiple buttons close the popup. I had the OK button and the cancel button centered and vertically aligned at the bottom of the window, but I also wanted a cancel button in the top right (ie "Cancel [X]") - with the familiar [X] that we know and love for closing something. The problem is, I couldn't figure out how to assign more than one control to the CancelControlID. After some sleuthing I discovered that the modalpopupextender has a method called Hide, which will do the needful. The question then, was how to access the modalpopupextender from the popup window that it opened. Both the popup panel and the modalpopupextender are contained in the same gridviewrow, so upon clicking the button, you simply have to "back out" to that level, in order to access the extender and execute the hide method.
Protected Sub closemodalbtnclick(ByVal sender As Object, ByVal e As System.EventArgs)
Dim modalpanel As Panel = CType(CType(sender, Button).Parent, Panel)
Dim containercell As DataControlFieldCell = CType(modalpanel.Parent, DataControlFieldCell)
Dim containerrow As GridViewRow = CType(containercell.Parent, GridViewRow)
Dim mpe1 As ModalPopupExtender = CType(containerrow.FindControl("mpe1"), ModalPopupExtender)
mpe1.Hide()
End Sub