protected void btnUpdate_Click(object sender, EventArgs e) { string PersonaliIdentificationNumber = LayoutProvider.GetNestedControlValueByFieldName("PersonalIdentificationNumber") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("PersonalIdentificationNumber").ToString(); string Name = LayoutProvider.GetNestedControlValueByFieldName("Name") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("Name").ToString(); string Bank = LayoutProvider.GetNestedControlValueByFieldName("Bank") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("Bank").ToString(); string IBAN = LayoutProvider.GetNestedControlValueByFieldName("IBAN") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("IBAN").ToString(); string Country = LayoutProvider.GetNestedControlValueByFieldName("Country") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("Country").ToString(); string City = LayoutProvider.GetNestedControlValueByFieldName("City") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("City").ToString(); string Address = LayoutProvider.GetNestedControlValueByFieldName("Address") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("Address").ToString(); int ProviderId = LayoutProvider.GetNestedControlValueByFieldName("ProviderId") == null ? 0 : (int)LayoutProvider.GetNestedControlValueByFieldName("ProviderId"); string BookingEmail = LayoutProvider.GetNestedControlValueByFieldName("BookingEmail") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("BookingEmail").ToString(); string Title = LayoutProvider.GetNestedControlValueByFieldName("Title") == null ? string.Empty : LayoutProvider.GetNestedControlValueByFieldName("Title").ToString(); var model = controller.GetData(ModelId); model.IBAN = IBAN; model.Name = Name; model.Bank = Bank; model.PersonalIdentificationNumber = PersonaliIdentificationNumber; model.Country = Country; model.City = City; model.Address = Address; model.Title = Title; model.ProviderId = ProviderId; model.BookingEmail = BookingEmail; controller.Update(model); }
protected void GridB2BCustomerView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { var list = (List <CoreViewModel>)GridB2BCustomerView.DataSource; CoreViewModel model = list.Find(m => m.Id == e.Keys[0].ToString()); model.Address = e.NewValues["Address"].ToString(); model.Bank = e.NewValues["Bank"].ToString(); model.City = e.NewValues["City"].ToString(); model.Country = e.NewValues["Country"].ToString(); model.IBAN = e.NewValues["IBAN"].ToString(); model.Name = e.NewValues["Name"].ToString(); model.PersonalIdentificationNumber = e.NewValues["PersonalIdentificationNumber"].ToString(); model.ProviderId = (int)e.NewValues["ProviderId"]; controller.Update(model); e.Cancel = true; GridB2BCustomerView.CancelEdit(); Bind(); }
protected void GridNoteView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { List <Note> notes = (List <Note>)GridNoteView.DataSource; string id = e.Keys[0].ToString(); Note note = notes.Find(m => m.Id == id); var newValue = e.NewValues; note.Date = newValue["Date"] == null ? DateTime.Now : (DateTime)newValue["Date"]; note.Text = newValue["Text"].ToString() ?? string.Empty; note.Title = newValue["Title"].ToString() ?? string.Empty; var model = controller.GetData(ModelId); model.Notes = notes; controller.Update(model); e.Cancel = true; GridNoteView.CancelEdit(); GridNoteView.DataSource = notes; GridNoteView.DataBind(); }