Exemplo n.º 1
0
        /// <summary>Handles the <see cref="GridView.RowDataBound"/> event of the <see cref="StatusesGrid"/> control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewRowEventArgs"/> instance containing the event data.</param>
        private void StatusesGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }

            var row = e.Row;

            if (row == null)
            {
                return;
            }

            var deleteButton = (Button)row.FindControl("DeleteButton");

            if (deleteButton == null)
            {
                return;
            }

            var statusId = GetStatusId(row);

            if (statusId.HasValue && ApplicationStatus.IsStatusUsed(statusId.Value))
            {
                deleteButton.Enabled = false;
                return;
            }

            deleteButton.Attributes["data-confirm-click"] = this.Localize("DeleteConfirm");
            Dnn.Utility.RequestEmbeddedScript(this.Page, "confirmClick.js");
        }