B
bbawa1
I have the followning code in my HTML part. But when I click on Deletw
link it deleted the record from gridview as well as from Datasource
but it give me following error page
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Updating is not
supported by ObjectDataSource 'ObjectDataSource1' unless the
deleteMethod is specified.
Here Is the code
DataKeyNames="UserId" DataSourceID="ObjectDataSource1"
OnRowCommand="gdAddUser_RowCommand"
OnRowDataBound="gdAddUser_RowDataBound"
OnRowDeleting="gdAddUser_RowDeleting"
Width="390px"
önSelectedIndexChanged="gdAddUser_SelectedIndexChanged"
AutoGenerateEditButton="True">
CommandArgument='<%# Eval("UserId") %>'
CommandName ="Delete">
Delete
protected void gdAddUser_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton l = (LinkButton)e.Row.FindControl("LinkButton1");
l.Attributes.Add("onclick", "javascript:return " +
"confirm('Are you sure you want to delete this record " +
DataBinder.Eval(e.Row.DataItem, "UserId") + "')");
}
}
protected void gdAddUser_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
// get the categoryID of the clicked row
int AppId = Convert.ToInt32(e.CommandArgument);
// Delete the record
DeleteRecordByID(AppId);
// Implement this on your own
}
}
//protected void gdAddUser_RowDeleted(object sender,
GridViewDeletedEventArgs e)
//}
protected void gdAddUser_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
int AppId = (int)gdAddUser.DataKeys[e.RowIndex].Value;
DeleteRecordByID(AppId);//implement yourself
}
link it deleted the record from gridview as well as from Datasource
but it give me following error page
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Updating is not
supported by ObjectDataSource 'ObjectDataSource1' unless the
deleteMethod is specified.
Here Is the code
DataKeyNames="UserId" DataSourceID="ObjectDataSource1"
OnRowCommand="gdAddUser_RowCommand"
OnRowDataBound="gdAddUser_RowDataBound"
OnRowDeleting="gdAddUser_RowDeleting"
Width="390px"
önSelectedIndexChanged="gdAddUser_SelectedIndexChanged"
AutoGenerateEditButton="True">
CommandArgument='<%# Eval("UserId") %>'
CommandName ="Delete">
Delete
protected void gdAddUser_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton l = (LinkButton)e.Row.FindControl("LinkButton1");
l.Attributes.Add("onclick", "javascript:return " +
"confirm('Are you sure you want to delete this record " +
DataBinder.Eval(e.Row.DataItem, "UserId") + "')");
}
}
protected void gdAddUser_RowCommand(object sender,
GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
// get the categoryID of the clicked row
int AppId = Convert.ToInt32(e.CommandArgument);
// Delete the record
DeleteRecordByID(AppId);
// Implement this on your own
}
}
//protected void gdAddUser_RowDeleted(object sender,
GridViewDeletedEventArgs e)
//}
protected void gdAddUser_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
int AppId = (int)gdAddUser.DataKeys[e.RowIndex].Value;
DeleteRecordByID(AppId);//implement yourself
}