asp.net coolite 删除时弹出确定按钮
程序员文章站
2024-03-09 17:30:59
界面上如下:
界面上如下:
<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 了
<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 了