为删除按钮添加提示

yu_yu 2006-12-01 11:07:40
VS2005 C#

如何为GridView(编辑 / 更新 / 取消 / 删除)中的删除按钮添加提示信息,就是在电击“删除”是弹出确认对话框。
...全文
411 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
yu_yu 2006-12-01
  • 打赏
  • 举报
回复
我说的是 VS2005 ,你那个好象是 2003对吧
yu_yu 2006-12-01
  • 打赏
  • 举报
回复
多谢
hegang888888888 2006-12-01
  • 打赏
  • 举报
回复
to peilianhai(网侠() 我为啥不地道?
nimeide1234567890 2006-12-01
  • 打赏
  • 举报
回复
><asp:Button id="Button1" runat="server" Text="發送" Height="24px"></asp:Button>
<asp:Button id="Button2" runat="server" Width="0px" ></asp:Button>

public void Confirm(string str_Message,string btn,Page page)
{
page.RegisterStartupScript("","<script> if (confirm('"+str_Message+"')==true){document.forms(0)."+btn+".click();}</script>");
}

private void Button1_Click(object sender, System.EventArgs e)
{
if(Session["UPower"].ToString()=="1" || Session["UPower"].ToString()=="9")
{
Confirm("您是否確認OK?","Button2",this);
}
else
{
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
ModifyKind(1);
this.Response.Redirect(this.Request.Url.ToString());
}
xbfitliu 2006-12-01
  • 打赏
  • 举报
回复
你把删除那列转换程模版列。
再HTML删除按钮里写
OnClientClick="javascript:return confirm('……');"
peilianhai 2006-12-01
  • 打赏
  • 举报
回复
楼上不地道
hegang888888888 2006-12-01
  • 打赏
  • 举报
回复
if (e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add("onclick", "confirm("Are you sure you want to delete this entry?');");
}
hegang888888888 2006-12-01
  • 打赏
  • 举报
回复
if (e.Item.ItemType == ListItemType.Item)
{
e.Item.Attributes.Add("onclick", "confirm("Are you sure you want to delete this entry?');");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#ffffff';");
}
mincunbao 2006-12-01
  • 打赏
  • 举报
回复
<Columns>
...
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
OnClientClick='return confirm("Are you sure you want to delete this entry?");'
Text="Delete" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
whu305 2006-12-01
  • 打赏
  • 举报
回复
<Columns>
...
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
OnClientClick='return confirm("Are you sure you want to delete this entry?");'
Text="Delete" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
keystudio 2006-12-01
  • 打赏
  • 举报
回复
写到相应的事件里去
peilianhai 2006-12-01
  • 打赏
  • 举报
回复
hegang888888888(我是农民) (我在说3楼!

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧