AJAX Control Toolkit Tutorial——ConfirmButton(确定按钮)

  

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.";
}

posted @ 2011-08-05 11:54  January  阅读(392)  评论(0编辑  收藏  举报