删除界面不需要设计,只需在后台写代码
前台:
<td width="100" align="center" valign="middle" bgcolor="#FFFFFF"><a href="Delete.aspx?ids=<%#Eval("ids") %>">删除</a> <a href="Update.aspx?ids=<%#Eval("ids") %>">修改</a></td>
后台C#:
public partial class Delete : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //页面传值,接收主键值 string ids = Request["ids"].ToString(); TestDataContext context = new TestDataContext(); Fruit data = context.Fruit.Where(p => p.Ids == ids).First();//查询 context.Fruit.DeleteOnSubmit(data);//删除 context.SubmitChanges();//提交 Response.Redirect("1217.aspx");//跳转页面 } }