AJAX Control Toolkit Tutorial——ConfirmButton(確定按鈕)

來源:互聯網
上載者:User

  

TargetControlID - The ID of the Button Control to extend.(要進行擴充的按鈕控制項)

ConfirmText - The confirmation text to display.HTML entities can be used,such as 
for a newline character.(要顯示的確認文本,可以是HTML實體,如一個分行符號)

OnClientCancel - The Client script to execute when the Cancel button is clicked in the confirm dialog box.(當單擊確認對話方塊“取消”按鈕時所執行的用戶端指令碼)

ConfirmOnFormSubmit - true if the confirm dialog box should not be displayed until just before the form is submitted.This is useful if the page contains ASP.NET validator controls and the confirm dialog box should be displayed only after all validation checks pass.false(default).(當值設定為true時,確認對話方塊只有在表單提交時才顯示,這在頁麵包含ASP.NET驗證控制項(也就是確認對話方塊只有在所有驗證控制項都通過時才顯示)是很有用的。)

DisplayModalPopID - Speicifies the ID of a ModalPopup control to use to display the confirm dialog box.instead of the default window.confirm window. When you use the DisplayModalPopupID property, the following conditions must be met:

a.The ModalPopup control must be configured with the same TargetControlID value as the ConfirmButton extender. (It will work properly if the ConfirmButton extender is disabled.)

b.The ModalPopup control must specify the OkControlID or the CancelControlID properties in order to identify the buttons that correspond to the the OK and Cancel buttons in the confirm dialog box.

c.The ModalPopup must not specify a OnOkScript or OnCancelScript property.

(這個屬性(低版本中沒有)比較麻煩哦,不過如果你想追求更好的表現效果的話,可以與ModalPopup組合使用,當使用該屬性的時候也就代替了預設的JavaScript window.confirm 視窗,而且你必須作如下設定:

a.ModalPopup控制項的TargetControlID必須和ConfirmButton控制項的一致; 
b.ModalPopup控制項中必須設定有效OkControlID和CancelControlID以和確認對話方塊的“確認”、“取消”按鈕相一致;

c.必須設定對應的OnOkScript和OnCancelScript處理指令碼。)

參看ModalPopup

 <Demo>

1 <asp:ScriptManager ID="ScriptManager1" runat="server" />
2 <div>
3 <br />
4 <asp:Label ID="Label1" runat="server" Width="273px"></asp:Label><br />
5 <br />
6 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" Width="175px" />
7 <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Button1"
8 ConfirmText="Are you sure you want to submit ?">
9 </ajaxToolkit:ConfirmButtonExtender>

 protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Text from the serverside.";
}

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.