在cs 的页添加"<input type='checkbox' name='del' value='55'>"
添加到页面中在服务器按纽点击时用Request[""]取值报错
Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. 谢谢给看看

解决方案 »

  1.   

    private void BtDel_Click(object sender, System.EventArgs e)
    {
    //Response.Write(Convert.ToString(Request["del"]));
    string ids =Convert.ToString(Request["del"]).Trim();
    string[] id = ids.Split(',');
    DbAccess db = new DbAccess();
    for(int i=0;i<id.Length;i++)
    {
    string sql = string.Format("delete from protype where protype_id='{0}'",id[i]);
    private void DgType_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
    {
    DataRowView drv = e.Item.DataItem as DataRowView;
    string id = Convert.ToString(drv["protype_id"]).Trim();
    string la = "<input type='checkbox' name='del' value='"+id+"'/>";
    e.Item.Cells[0].Text=la;
    }
    }
    db.GetState(sql);
                 // Response.Write("<script>alert('"+id[i]+"')</script>");
    }
    Response.Write("<script>alert('成功删除');document.location='typelist.aspx'</script>");
    }