我在模板里边添加了一个button
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs)
Dim id As Integer = GridView1.DataKeys(e.RowIndex).Value
Dim adapter As New ArticleSetTableAdapters.Table1TableAdapter()
adapter.Delete(id)
Response.Redirect("/control.aspx")
End Sub使用gridview自带得删除功能可以删除但是在button得 click事件里边添加 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim u As String = CType(sender, Button).CommandArgument() Dim adapter As New ArticleSetTableAdapters.Table1TableAdapter()
adapter.Delete(u)
这样就有错误请高手赐教错误是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.
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs)
Dim id As Integer = GridView1.DataKeys(e.RowIndex).Value
Dim adapter As New ArticleSetTableAdapters.Table1TableAdapter()
adapter.Delete(id)
Response.Redirect("/control.aspx")
End Sub使用gridview自带得删除功能可以删除但是在button得 click事件里边添加 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim u As String = CType(sender, Button).CommandArgument() Dim adapter As New ArticleSetTableAdapters.Table1TableAdapter()
adapter.Delete(u)
这样就有错误请高手赐教错误是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.
解决方案 »
- asp.net mvc动态生成控件
- asp.net怎么post提交数据?
- ADO.NET调用Access分页,速度有点慢,请大家进来看看,如何优化
- asp.net【下载浏览器里面的音频文件】一个按钮点击就下载保存
- 获取iframe内或外对象的问题
- 系统是xp,装了2003的iis,坏了
- 如何获得前一链接的关键字?
- ■■■在datagrid删除数据提示当前页大于总页数的问题~■■■
- 简单问题,如何判断textbox中的字符的行数.注意,不是textbox的行数,以前实现过,现在忘了:(
- ibatis框架oracle数据库查询的问题
- 我的aspx页面被访问后。sql sysprocess 数据库中有很多的 连接为状态为sleeping
- 急求知道的人指点:asp.net2.0 web中如何实现类似excel的表格功能
{
foreach (GridViewRow gvr in gvLoans.Rows)
{
CheckBox chk = (CheckBox)gvr.Cells[1].FindControl("chk");
if (chk.Checked)
{
gvLoans.DeleteRow(gvr.RowIndex);
}
}
}