2014-03-30 2 views
0

웹 응용 프로그램의 단일 소스 팝업 모달에 대해 생각해 냈습니다. 마스터 페이지에 자리 표시자를 넣고 아래 코드를 별도의 클래스에 넣습니다. 클래스 파일은 메시지를 받고 모달 HTML을 만듭니다.어쨌든 contentpage 업데이트 패널에서 masterpage 컨트롤을 수정 하시겠습니까?

전체 포스트 백에서 작동하지만 아약스 업데이트 패널에서 호출 할 때는 작동하지 않습니다.

이유를 알고 있습니다. 나는 주변에 어떤 방법이 있는지 모른다. 어떤 아이디어?

Public Class Common 
    Inherits SiteMaster  

    Public Shared Sub showModalMsg(ByVal sMsg As String) 

    Dim lbl As New Label 
    lbl.Text = sMsg 
    '(for simplicity, the building of the div to make the modal is omitted) 


    Dim pageHandler = HttpContext.Current.CurrentHandler 
    If TypeOf pageHandler Is System.Web.UI.Page Then 
     Dim ph As PlaceHolder = DirectCast(pageHandler, System.Web.UI.Page).Master.FindControl("phModalDialog") 
     If ph IsNot Nothing Then 
      ph.Controls.Add(lbl) 
     End If 
    End If 

End Class 

답변