请问ASPxGridView 怎么做删除提示 谢谢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete" OnClientClick="return confirm('确认要删除吗?如果删除,在这个职位的员工所有信息将一起删除');" Text="删除"></asp:LinkButton> </ItemTemplate> 使用的是ASPxGridView自带的删除按钮DeleteButton protected void GridViews_RowDataBound(object sender, GridViewRowEventArgs e){ 这里加入 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { e.Item.Attributes.Add("onmouseover", "color=this.style.backgroundColor;this.style.backgroundColor='#669988'"); e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=color"); ((LinkButton)(e.Item.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('你确定要删除此信息吗?');"); }} 在删除按钮的那一列属性里面,把DeleteText属性设为 <div id="de" onclick="JavaScript:return confirm('确定删除吗?')">删除</div> 如果你用的是aspxGridView自带的删除的话可以这样操作右键->属性->settings->SettingsBehavior->ConfirmDelete 将属性值设为True然后 在Settings->SettingsText->ConfirmDelete 将属性设为你的提示文字 如"确定要删除吗?"能否解决??? 要看你的ASPxGridView具体是什么版本。我的9.3.4是这样做的:步骤一:步骤二: 如果是AspxGridView自带的删除按钮,那么11楼的解决办法完全够用。如果你用的是自定义按钮,要自定义完成删除动作,那么就需要自己定制按钮列,并在服务器端的CustomButtonCallback事件中书写删除代码。在这种情况下要实现删除确认,需要:在AspxGridView的Client-Side Event中(在aspxGridView的任务菜单中可以找到)设置CustomButtonClick事件代码如下:function(s, e) { grid.SetFocusedRowIndex(e.visibleIndex); e.processOnServer = true; if(e.buttonID == "DeleteRecord") if(!confirm('该操作无法恢复,您确认执行删除吗?')) e.processOnServer = false;}其中grid为AspxGridView的ClientInstanceName。几个有用的链接:1、Question Details: CustomButtonCallback confirm Delete2、ASPxClientGridView.CustomButtonClick Event 请问如何在VS或者DW设计模式里, 实现层的自由拖动? asp:TextBox如何添加一个单击事件? 购 OA 源码 ◆◇◆ aspx 页面转 excel 出现乱码! ◆◇◆ 怎么样取得本地的机器的名称和ip地址 TextBox的onclick事件,如何加cs中定义的方法; NHibernate + xmlhttp 刷新问题 还是没搞懂,谁能写详细点吗? IP段限制问题 请问.aspx页面中可以调用包含一个asp页面吗?怎么做?谢谢!! VS 2005开发Silverlight问题 在Repeater中如何获取在数据库中的Id字段值,求解
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
OnClientClick="return confirm('确认要删除吗?如果删除,在这个职位的员工所有信息将一起删除');" Text="删除"></asp:LinkButton>
</ItemTemplate>
{
这里加入
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add("onmouseover", "color=this.style.backgroundColor;this.style.backgroundColor='#669988'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=color");
((LinkButton)(e.Item.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('你确定要删除此信息吗?');");
}
}
<div id="de" onclick="JavaScript:return confirm('确定删除吗?')">删除</div>
然后 在Settings->SettingsText->ConfirmDelete 将属性设为你的提示文字 如"确定要删除吗?"能否解决???
我的9.3.4是这样做的:
步骤一:步骤二:
grid.SetFocusedRowIndex(e.visibleIndex);
e.processOnServer = true; if(e.buttonID == "DeleteRecord")
if(!confirm('该操作无法恢复,您确认执行删除吗?'))
e.processOnServer = false;
}其中grid为AspxGridView的ClientInstanceName。几个有用的链接:
1、Question Details: CustomButtonCallback confirm Delete
2、ASPxClientGridView.CustomButtonClick Event