首页 > 编程 > .NET > 正文

asp.net coolite 删除时弹出确定按钮

2024-07-10 12:38:30
字体:
来源:转载
供稿:网友
界面上如下:
<ext:Button ID="btnDel" runat="server" Icon="Delete" Text="删除" >
<Listeners ><Click Handler="CompanyUser.DoConfirm()"/></Listeners>
</ext:Button>
还需要注意要加句这样的代码
<ext:ScriptManager ID="ScriptManager1" runat="server" AjaxMethodNamespace="CompanyUser">
</ext:ScriptManager>
这个的CompanyUser 就是你建立页面的名称如:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CompanyUser.aspx.cs" Inherits="xitong_CompanyUser" %>
CS里面的方法如下
代码如下:
/// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
///
[AjaxMethod]
public void onDeleteClick()
{
Coolite.Ext.Web.CheckboxSelectionModel rsm = GridPanel1.SelectionModel.Primary as Coolite.Ext.Web.CheckboxSelectionModel;
int count = 0;
foreach (Coolite.Ext.Web.SelectedRow sm in rsm.SelectedRows)
{
count = user.DeleteCompanyUser(int.Parse(sm.RecordID));
}
if (count > 0)
{
Ext.MessageBox.Alert("提示", "删除成功").Show();
}
else
{
Ext.MessageBox.Alert("提示", "删除失败,没有选中行!" ).Show();
}
BindStore();
}
/// <summary>
/// 弹出删除对话框
/// </summary>
[AjaxMethod]
public void DoConfirm()
{
Ext.Msg.Confirm("消息提示", "是否删除选中行?", new MessageBox.ButtonsConfig
{
Yes = new MessageBox.ButtonConfig
{
Handler = "CompanyUser.onDeleteClick()",
Text = "是"
},
No = new MessageBox.ButtonConfig
{
Text = "否"
}
}).Show();
}

就OK 了
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表