2009-03-09 8 views
0

내 프로젝트에서 Ajax와 Jquery를 만나기 전에 아래와 같은 기능을했습니다.컨트롤 라이트 박스 (모달) Asp.Net 코드 숨김에서

Public Sub Raise_Alarm(ByVal p_Page As Page, ByVal p_Message As String, Optional ByVal p_IsError As Boolean = True) 

strScript = "<script language= ""javascript""> alert('" & p_Message.Replace("'", "") & "')</script>" 
    Dim t As Type = p_Page.GetType() 
    p_Page.ClientScript.RegisterStartupScript(t, "alert", strScript) 
    Dim mylabel As Label 

end sub 

필자는 위의 함수 대신 라이트 박스 (모달 상자)로 메시지를 표시하는 함수를 원합니다.

어떻게하면됩니까?

답변

1

이 작동합니다 :

strScript = "$('<div>" & p_Message.Replace("'", "\'") & "</div>').jqm();"; 
ClientScriptManager.RegisterStartupScript(p_Page.GetType(), "alert", strScript, true); 
1

jqModal과 같은 모달 윈도우를 표시하는 데 유용한 jQuery 플러그인 중 하나를 사용해보십시오. 문서는 모달 창을 구성하고 시작하는 방법을 설명하고 훌륭한 예제를 포함합니다. (1) 위의 cxfx에 의해 제안 당신이 jqModal를 사용하려면

+0

나는 이미 살펴 봤지만 코드의 함수에서 사용하는 방법을 묻습니다. – mavera

1

는 "Thickbox와"그냥 모달에 noraml aspx 페이지를 표시 할 수 있습니다 사용하는 경우 창문. 그런 다음 정상적으로 코드 숨김을 사용할 수 있습니다.

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 

<link href="/themes/ui.all.css" rel="stylesheet" type="text/css" />  
<link runat="server" href="/styles/thickbox.css" rel="stylesheet" type="text/css" />  
<!-- jQuery --> 
<script type="text/javascript" src="/scripts/jquery-1.3.2.js"></script> 
<script type="text/javascript" src="/scripts/ui.core.js"></script> 
<script type="text/javascript" src="/scripts/thickbox.js"></script>  

</head> 
<body> 
     <a class="thickbox" href="mylink.aspx?KeepThis=true&TB_iframe=true&height=300&width=850">modal thick box link</a> 
</body> 
</html> 

희망이 있습니다.

+0

사실, 나는 그것을 사용하려고 시도했지만, ı could not. 샘플 코드를 작성할 수 있습니까? – mavera

+0

이것은 최고입니다. 나는 똑같은 것을 찾고있었습니다. 존 고마워요. – Shyju

관련 문제