<a href="DelProduct.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>" ><div onclick="return confirm('确定要删除吗?');">删除</div></a>
这样也试过
<a href="DelProduct.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>" onclick="return confirm('确定要删除吗?');" >删除/a>
在ASP里没有问题的啊 在这里怎么不行了... 有提示是否删除,但是不管是还是否 都不起作用
这样也试过
<a href="DelProduct.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>" onclick="return confirm('确定要删除吗?');" >删除/a>
在ASP里没有问题的啊 在这里怎么不行了... 有提示是否删除,但是不管是还是否 都不起作用
说说你的环境或者贴你生成的html<%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
<a href="http://dotnet.aspx.cc" onclick="return confirm('确定要删除吗?');">删除</a>
</div>
</form>
</body>
</html>
这个页面看看load中有没有接到productID参数!
以下是我现在的页面
<%@ Page Language="C#" MasterPageFile="~/MasterPage/TopMenu.master" AutoEventWireup="true" CodeFile="EditProduct.aspx.cs" Inherits="ProductManage_ModifyProduct" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table width="950">
<tr>
<td style="width: 200px" valign="top">
</td>
<td style="width: 100px"> <table>
<tr>
<td style="width: 700px;">
<a href="AddProduct.aspx">新增商品</a></td>
</tr>
<tr>
<td style="width: 700px; height: 39px;">
<table>
<tr>
<td colspan="5">
关键字:</td>
<td style="width: 100px">
<asp:TextBox ID="TextBoxSearch" runat="server"></asp:TextBox></td>
<td style="width: 105px">
<asp:Button ID="ButtonSearch" runat="server" Text="搜索" OnClick="ButtonSearch_Click" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width: 700px; height: 22px">
<asp:GridView ID="GridViewProductEdit" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Width="700px" AllowPaging="True" OnPageIndexChanging="GridViewProductEdit_PageIndexChanging" DataKeyNames="ProductID" OnDataBound="GridViewProductEdit_DataBound" OnRowDataBound="GridViewProductEdit_RowDataBound" >
<FooterStyle BackColor="White" ForeColor="#000066" />
<Columns>
<asp:TemplateField HeaderText="商品照片">
<ItemTemplate>
<table width="80">
<tr>
<td style="width: 100px; text-align: center;">
<img alt="" src="<%# ShowProductPic(DataBinder.Eval(Container.DataItem,"ProductID"))%>" width="80" height="80"/>
</td>
</tr>
<tr>
<td style="width: 100px; text-align: center;">
<%# DataBinder.Eval(Container.DataItem, "ProductID")%></td>
</tr>
</table>
</ItemTemplate>
<ItemStyle Width="80px" Font-Size="12px" />
</asp:TemplateField>
<asp:BoundField HeaderText="商品名" DataField="Producttitle" >
<ItemStyle HorizontalAlign="Center" Width="220px" Font-Size="12px" />
</asp:BoundField>
<asp:BoundField HeaderText="拥有人" DataField="ownername" >
<ItemStyle HorizontalAlign="Center" Width="125px" Font-Size="12px" />
</asp:BoundField>
<asp:TemplateField HeaderText="展示状态">
<ItemStyle Width="125px" Font-Size="12px" HorizontalAlign="Center" />
<ItemTemplate>
<table><tr><td>
<span style="color: #0000ff;"><%# DataBinder.Eval(Container.DataItem, "ProductVisibleName")%></span>
</td></tr><tr><td>
<!--<span style="color: #0000ff;"><a href="ChangeVisible.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>">操作</a></span>-->
<span style="color: #0000ff;" onclick=" ChangeVisible('window','<%# DataBinder.Eval(Container.DataItem,"ProductID")%>')">操作</span>
</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="销售状态">
<ItemStyle Font-Size="12px" HorizontalAlign="Center" Width="125px" />
<ItemTemplate>
<table><tr><td>
<span style="color: #0000ff;" ><%# DataBinder.Eval(Container.DataItem, "ProductSaleFlagName")%></span>
</td></tr><tr><td>
<!--<span style="color: #0000ff;"><a href="ChangeSaleFlag.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>">操作</a></span>-->
<span style="color: #0000ff;" onclick=" ChangeSaleFlag('window','<%# DataBinder.Eval(Container.DataItem,"ProductID")%>')">操作</span>
</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<table>
<tr>
<td style="width: 125px" align="center">
<a href="ModiProduct.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>">修改基本信息</a> </td>
</tr>
<tr>
<td style="width: 100px; height: 26px; text-align: center;">
<a href="DelProduct.aspx?ProductID=<%# DataBinder.Eval(Container.DataItem,"ProductID")%>" ><div onclick="return confirm('确定要删除吗?');">删除</div></a>
</td>
</tr>
<tr>
<td align="center" style="width: 100px; height: 18px;">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" /></td>
</tr>
</table>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="125px" Font-Size="12px" />
</asp:TemplateField>
</Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerSettings Position="TopAndBottom" />
</asp:GridView>
</td>
</tr>
<tr>
<td style="width: 700px; height: 20px;">
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Content>
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="TopMenu.master.cs" Inherits="MasterPage_TopMenu" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<link href="../Css/style.css" rel="stylesheet" type="text/css" />
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="LabelUser" runat="server" Text="用户:" Width="132px"></asp:Label>
<asp:Label ID="LabelRole" runat="server" Text="角色:" Width="132px"></asp:Label> <br />
<asp:Menu ID="Menu_Main" runat="server" Orientation="Horizontal">
<StaticMenuStyle BackColor="#FFFF80" />
<StaticMenuItemStyle BackColor="LightGray" BorderColor="Maroon" BorderStyle="Solid"
BorderWidth="1px" Font-Names="宋体" Font-Size="Larger" Font-Strikeout="False" ForeColor="Black" />
</asp:Menu>
<br />
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
看你生成的 最后的html,看这些没有用。要学会调试去除没用的,只留相关的