protected void DataGrid_Update(object sender, DataGridCommandEventArgs e) { Page.Validate(); if (Page.IsValid) { int index = grid.EditItemIndex; if (index >= phones.Count) { phones.Add(""); } Phone phone = phones[index]; DataGridItem item = grid.Items[index]; phone.Value = ((TextBox)item.FindControl("phone")).Text; phone.UseType = ((TextBox)item.FindControl("useType")).Text; entity.Save(); grid.EditItemIndex = -1; CancelEditMode(); PopulateDataGrid(); } }
private object ConvertPhoneCollectionFromString(object value) { string phoneString = (string)value; string[] phones = phoneString.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); PhoneCollection phoneCollection = new PhoneCollection(); for (int i = 0; i < phones.Length; i++) { string normalizedPhone = PhoneNumberUtils.ValidatePhoneNumber(phones[i]); phoneCollection.Add(normalizedPhone); } return phoneCollection; }
private object ConvertPhoneCollectionFromString(object value) { string phoneString = (string)value; string[] phones = phoneString.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); PhoneCollection phoneCollection = new PhoneCollection(); for (int i = 0; i < phones.Length; i++) { string normalizedPhone = PhoneNumberUtils.ValidatePhoneNumber(phones[i]); phoneCollection.Add(normalizedPhone); } return(phoneCollection); }
public static void FillPhoneList(PhoneCollection coll, SqlDataReader reader, int totalRows, int firstRow) { int index = 0; bool readMore = true; while (reader.Read()) { if (index >= firstRow && readMore) { if (coll.Count >= totalRows && totalRows > 0) { readMore = false; } else { Phone trx = Phone.GetPhone(reader); coll.Add(trx); } } index++; } }