/// <summary>
 /// Respond to the click event of the button for adding an existing
 /// author by adding the selected author to the list of authors
 /// for the module being created.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The event arguments.</param>
 public void AddExistAuthBtn_Click(object sender, EventArgs e)
 {
     if (!AuthorsEditor.Editing)
     {
         Authors.AuthorInfo ai = Authors.getAuthorInfo(existAuthLst.SelectedValue);
         AuthorsEditor.DataList.Add(ai);
         AuthorsEditor.DataBind();
     }
     else
     {
         AuthorsEditor.Text = "Click <strong>Apply</strong> or <strong>Cancel</strong> before attempting to add an entry.";
     }
 }
        /// <summary>
        /// Respond to the update event, when an item is being edited and
        /// subsequently updated, by updating the info object of the
        /// item being edited.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The event arguments</param>
        private void AuthorsEditor_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            DropDownList ddl = (DropDownList)e.Item.Cells[1].FindControl("existAuthLst");

            Authors.AuthorInfo ai = Authors.getAuthorInfo(ddl.SelectedValue);
            AuthorsEditor.DataList[(int)e.Item.ItemIndex] = ai;
            AuthorsEditor.DataBind();

            if (hasDuplicates())
            {
                AuthorsEditor.Text = "That author has already been added.";
                AuthorsEditor.DataList.RemoveAt((int)e.Item.ItemIndex);
            }
            else
            {
                AuthorsEditor.Text = "";
            }
        }
 /// <summary>
 /// Initialize the list of authors.
 /// </summary>
 /// <param name="moduleID">The module identifier for the
 /// initial list of authors or 0 if it should be initially empty.</param>
 public void initList(int moduleID)
 {
     if (moduleID == 0)
     {
         AuthorsEditor.DataList = new ArrayList();
         string             username = Context.User.Identity.Name;
         Authors.AuthorInfo ai       = Authors.getAuthorInfo(username);
         AuthorsEditor.DataList.Add(ai);
         AuthorsEditor.DataBind();
     }
     else if (moduleID > 0)
     {
         AuthorsEditor.DataList = Authors.getAll(moduleID);
         AuthorsEditor.DataBind();
     }
     else
     {
         throw new ArgumentException("Invalid module identifier.", "moduleID");
     }
 }
 /// <summary>
 /// Respond to the new item event, when the user elects to create a
 /// new item, by creating the specific info class and adding it to
 /// the editor control's data list.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The event arguments</param>
 private void AuthorsEditor_NewItemEvent(object sender, EventArgs e)
 {
     Authors.AuthorInfo ai = new Authors.AuthorInfo("", "", "");
     AuthorsEditor.DataList.Add(ai);
 }