protected void ContactDataView_CustomCallback(object sender, CallbackEventArgsBase e) { if (string.IsNullOrEmpty(e.Parameter)) { return; } var args = e.Parameter.Split('|'); if (args[0] == "Delete" && args.Length == 2) { int id; if (!int.TryParse(args[1], out id)) { return; } ContactsBL bl = new ContactsBL(); bl.DeleteContact(id); BindDataView(); } if (args[0] == "SaveContact") { var name = ContactNameEditor.Text; var email = ContactEmailEditor.Text; var address = ContactAddressEditor.Text; var country = ContactCountryEditor.Text; var city = ContactCityEditor.Text; var phone = ContactPhoneEditor.Text; var photoUrl = Utils.GetUploadedPhotoUrl(args[2]); int id; if (args.Length == 4 && args[1] == "Edit" && int.TryParse(args[3], out id)) { ContactsBL bl = new ContactsBL(); bl.UpdateContact(id, name, email, address, country, city, phone, photoUrl); } else if (args.Length == 3 && args[1] == "New") { ContactsBL bl = new ContactsBL(); bl.AddContact(name, email, address, country, city, photoUrl, photoUrl); } BindDataView(); } }