2011-07-01 65 views
0

我想有一個很好的彈出警告,說「你確定要覆蓋這個文件嗎?是的沒有。有沒有辦法用telerik或Ajax Tool Kit做到這一點?我想要能夠與C#來控制它在服務器端太彈出警告消息

謝謝

+2

你想什麼在服務器端的控制?因爲你有ajax工具包,你不能使用javascript'confirm'並通過ajax把控制權交給服務器端? – Xinus

+0

沒有嘗試過,不喜歡它 – user710502

+1

你是什麼意思,控制它在服務器端?該頁面將在客戶端上運行,您要控制哪一方面? –

回答

1

一種方式可能是

1)創建像一個彈出

2格)顯示彈出當某些事件發生時(如點擊按鈕)

3)如果用戶單擊確定,然後做服務器端出頭

4),如果用戶點擊不那麼喜de the div

這裏有一些代碼,對不起,如果有一些錯誤,但我沒有我的手上的環境。

<head> 
<script type="text/javascript"> 
function showConfirm() 
{ 
    var popup = document.getElementbyId('popup'); 
    popup.style.display = ''; 
} 
function hide() 
{ 
    var popup = document.getElementbyId('popup'); 
    popup.style.display = 'none'; 

} 
</script> 
</head> 
<body> 
<form runat="server" id="form1"> 
    <div id="popup" style="display:none"> 
    <p>bla bla bla</p> 
    <asp:button id="btn_ok" runat="server" OnClick="ServerRountine_Click"/> 
    <asp:button id="btn_ko" runat="server" onclientclick="hide();"/> 
    </div> 

<asp:button id="btn_overwrite" runat="server" onclientclick="showConfirm();"/> 
</form> 
</body> 
0

你可以把一個OnCl您ICK(或的OnClientClick如果它是一個服務器端控件)事件提交按鈕,如下所示:

<input type="button" value="Submit new file" onclick="if(confirm('Are you sure you want to overwrite this file?')) return false;" /> 
0

我prolly使用這個ASP modalpopup,P ...但是,是的,你想用AJAX做等 我想你會愛上JQ-UI即可。

它幾乎與上面相同,但它會在樣式同時彈出,P

$("#modEdit").dialog({//modEdit is your Div with any controls. 
       autoOpen: false,//Properties 
       width: 600, 
       show: "fade", 
       hide: "fade", 
       modal: true, 
       buttons: {//Buttons 
        "Save Changes": function() { 
         ModSaveChanges(); 
         $(this).dialog("close"); 
        }, 
        Cancel: function() { 
         $(this).dialog("close"); 
        } 
       } 
      }); 

語法看起來在短期是這樣$(控制).dialog({屬性,按鈕:{ BTN1,BTN2}});等
真的很容易,我真的建議更換它^^:d 我已經用了我的移動應用,P
哦,你也可以再看看到煎茶內線,P