在ext.net中 经常会遇到需要弹出对话框进行选择的操作 目前总共发现了两种方式 一种为前台js脚本 另一种则是写在.cs文件中 如下:
1. js脚本:
Ext.Msg.confirm('系统提示', '确定要删除' + curNode.attributes.shopName + '餐厅信息吗?', function (btn) {
if (btn == 'yes') {
Ext.net.DirectMethods.DelShopInfo(curNode.attributes.shopId, curNode.attributes.meaId, {
success: function () {
mi_meaDel.setDisabled(false);
mi_shopDel.setDisabled(true);
TabPanel1.addTab(pMeaShops);
TabPanel1.closeTab(pShopInfo);
},
failure: function (errorMsg) {
Ext.Msg.alert('Failure', errorMsg);
}
});
}
}, this);
var config = {
title: "提示",
msg: "确定删除日时段信息?",
closable: false,
buttons: Ext.MessageBox.OKCANCEL,
icon: Ext.MessageBox.QUESTION,
animEl: "fly",
fn: function (btn) {
if (btn == "ok")
Ext.net.DirectMethods.DelDayInfo(record.data.DAYTIMEID);
}
};
Ext.MessageBox.show(config);
2. C#:
ExtNet.Msg.Confirm("提示", "如果删除用户,将清空用户的所有相关信息,确定要删除吗?", new MessageBoxButtonsConfig
{
Ok = new MessageBoxButtonConfig
{
Handler = "Ext.net.DirectMethods.DelUser(" + sel_userid.Text + ",{ failure: function (errorMsg) { Ext.Msg.alert('失败', '删除用户信息失败');}});",
Text = "确定"
},
Cancel = new MessageBoxButtonConfig
{
Text = "取消"
}
}).Show();
ExtNet.MessageBox.Show(new MessageBoxConfig()
{
Icon = MessageBox.Icon.ERROR,
Title = "提示",
Message = "用户名或密码不能为空!",
AnimEl = "fly",
Modal = true,
Buttons = MessageBox.Button.OK
});