datagrid带提示框的删除按纽问题 急啊 在线等
我在datagrid里做了一列删除按纽,前台代码是这样的
<asp:ButtonColumn Text= "<div id="nid" onclick="javascript:return confirm( '确定删除吗? ')">删除信息</div> " HeaderText= "删除 " CommandName= "Delete "> </asp:ButtonColumn>
后台我在private void dgnews_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ViewState[ "newid "]=this.dgnews.Items[(int)e.Item.ItemIndex].Cells[0].Text.ToString();
string s= "delete * from sp where id= "+ViewState[ "newid "].ToString();
int i=DataHandler.ExecuteNonQuery(s);
}事件里做了删除 ,可是这个删除不管我在提示对话矿里点取消还是执行删除 能不能让我点取消就返回不执行删除啊 ,现在怎么点都执行删除
------解决方案--------------------应该与你的浏览器有关.
------解决方案-------------------- <asp:LinkButton runat= "server "CommandName= "delete " OnClientClick= "return confirm( '确认删除? '); " Text= "删除 "> </asp:LinkButton>