2016-07-28 88 views
-2

在ASP.Net中,我使用modalpopupextender來顯示某種原因的模式彈出窗口,即modalpopupextender工作正常。但我的問題是我需要完成任務後顯示簡單的模態彈出。無論任務是成功顯示成功消息還是失敗並且還有一個更重要的是我需要隱藏modalpopupextender。我一直在使用JavaScript的嘗試,它是顯示警告信息,但modalpopupextender不會躲,下面是代碼如何使用Javascript顯示模式彈出窗口

if (finalresult == 1) 
      { 
       modalpopup.Hide(); 
       Response.Write("<script>alert('Done');</script>"); // if success display success message 
      } 
      else 
      { 
       Response.Write("<script>alert('Error');</script>"); // if fail display error msg 

      } 

而不是使用警告腳本,我可以使用任何JavaScript或jQuery的模態彈出包括我需要隱藏modalpopupextender平行請幫幫我。

+0

互聯網上谷歌和發現的例子,如果你不知道該編程的asp.net – Aristos

+0

使用'ScriptManager.RegisterClientScriptBlock(這一點,this.GetType(), 「alertMessage」,「使用alert('Record Inserted Successfully')「,true);' – mmushtaq

+0

我已經在谷歌搜索和我有這麼多的東西,但我的問題是需要隱藏modalpopupextender .....以及如何顯示消息...... –

回答

1

你提到你可以使用jQuery。考慮到這一點,希望你可以包含jQuery的UI插件,jQuery UI

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.css"> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js"></script> 
 
<script> 
 
    $(function() { 
 
    $("#dialog").dialog(); 
 
    }); 
 
</script> 
 
<!-- --> 
 
<div id="dialog" title="Title here"> 
 
    <p>Dialog text here</p> 
 
</div>