/// ----------------------------------------------------------------------------- /// <summary> /// Moves a property /// </summary> /// <param name="index">The index of the Property to move</param> /// <param name="destIndex">The new index of the Property</param> /// ----------------------------------------------------------------------------- private void MoveProperty(int index, int destIndex) { ProfilePropertyDefinition profileProperty = ProfileProperties[index]; ProfilePropertyDefinition nextProfileProperty = ProfileProperties[destIndex]; int currentOrder = profileProperty.ViewOrder; int nextOrder = nextProfileProperty.ViewOrder; //Swap ViewOrders profileProperty.ViewOrder = nextOrder; nextProfileProperty.ViewOrder = currentOrder; //Refresh Grid ProfileProperties.Sort(); BindGrid(); }
/// ----------------------------------------------------------------------------- /// <summary> /// This method is responsible for taking in posted information from the grid and /// persisting it to the property definition collection /// </summary> /// ----------------------------------------------------------------------------- private void ProcessPostBack() { string[] newOrder = ClientAPI.GetClientSideReorder(grdProfileProperties.ClientID, Page); for (int i = 0; i <= grdProfileProperties.Items.Count - 1; i++) { DataGridItem dataGridItem = grdProfileProperties.Items[i]; ProfilePropertyDefinition profileProperty = ProfileProperties[i]; CheckBox checkBox = (CheckBox)dataGridItem.Cells[COLUMN_REQUIRED].Controls[0]; profileProperty.Required = checkBox.Checked; checkBox = (CheckBox)dataGridItem.Cells[COLUMN_VISIBLE].Controls[0]; profileProperty.Visible = checkBox.Checked; } //assign vieworder for (int i = 0; i <= newOrder.Length - 1; i++) { ProfileProperties[Convert.ToInt32(newOrder[i])].ViewOrder = i; } ProfileProperties.Sort(); }