예제 #1
0
        /// <summary>
        /// Handles the Click event of the deleteRow control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void deleteRow_Click(object sender, EventArgs e)
        {
            var rowToDelete = new StoredValueRow();
            foreach (
                StoredValueRow row in Rows.Where(row => row.Id.ToString().Equals(((LinkButton)sender).CommandArgument)))
            {
                rowToDelete = row;
            }

            Rows.Remove(rowToDelete);

            Store();
            Save();
        }
예제 #2
0
        /// <summary>
        /// Handles the Click event of the addRow control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="System.EventArgs"/> instance containing the event data.
        /// </param>
        protected void addRow_Click(object sender, EventArgs e)
        {
            var row = new StoredValueRow { Id = this.GetAvailableId(), SortOrder = this.Rows.Count() + 1 };

            foreach (var t in this.InsertDataTypes)
            {
                // Save value to datatype
                DataTypeHandlerServiceLocator.Instance.Save(t.Value, new DataTypeSaveEventArgs(this, DataTypeAction.Add));

                // Create new storedvalue object
                var v = new StoredValue { Name = t.Name, Alias = t.Alias, Value = t.Value };

                row.Cells.Add(v);
            }

            this.Rows.Add(row);

            Store();
            Save();
        }