I write this code for delete from repeater,but I have a problem. when I run my page ad delete one of rows , this row is deleted and when I refresh that page , another one rows deleted that I don't want delete that.in fact I want to delete one row but delete two row when I refresh page
protected void SendBoxrep_ItemCommand(object source, RepeaterCommandEventArgs e)
{
MembershipUser Admin = Membership.GetUser(User.Identity.Name);
if (e.CommandName == "del")
{
Guid g = new Guid(e.CommandArgument.ToString());
MessageClass.deleteMessage(g);
SendBoxrep.DataSource = MessageClass.selectMessagesUser(Admin);
SendBoxrep.DataBind();
}
}
public static void deleteMessage(Guid id)
{
foreach (Message item in MessageClass.LoadAll(id))
{
MDB.Messages.DeleteOnSubmit(item);
MDB.SubmitChanges();
}
}