protected void GridViewProperty_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            TextBox txtLabelGrid = null;

            ImageButton lnkEdit   = null;
            ImageButton lnkDelete = null;

            //  System.Web.UI.WebControls.Panel pnlMovePanel = null;
            LiteralState ls       = (LiteralState)e.Row.DataItem;
            Label        lblLabel = (Label)e.Row.FindControl("lblLabel");

            LiteralState literalstate = null;

            if (e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Cells[0].Text = "Keyword";
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                lnkEdit   = (ImageButton)e.Row.Cells[1].FindControl("lnkEdit");
                lnkDelete = (ImageButton)e.Row.Cells[1].FindControl("lnkDelete");
                // pnlMovePanel = (System.Web.UI.WebControls.Panel)e.Row.Cells[2].FindControl("pnlMovePanel");


                literalstate = (LiteralState)e.Row.DataItem;

                if (literalstate.EditDelete == false)
                {
                    lnkDelete.Visible = false;
                }
                if (literalstate.EditExisting == false)
                {
                    lnkEdit.Visible = false;
                    //     pnlMovePanel.Visible = false;
                }

                if (lnkDelete != null)
                {
                    lnkDelete.OnClientClick = "Javascript:return confirm('Are you sure you want to delete these " + PropertyLabel + "?');";
                }

                if (lblLabel != null)
                {
                    lblLabel.Text = "" + literalstate.Literal.Replace("\n", "<br/>");
                }
            }

            if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
            {
                txtLabelGrid      = (TextBox)e.Row.Cells[0].FindControl("txtLabelGrid");
                txtLabelGrid.Text = "" + literalstate.Literal.Trim();
                txtLabelGrid.Attributes.Add("data-autocomplete-url", Root.Domain + "/edit/Modules/CustomEditFreetextKeyword/keywordAutocomplete.aspx?keys=");
            }
        }
示例#2
0
        protected void GridViewProperty_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            TextBox txtLabel = null;

            ImageButton lnkEdit   = null;
            ImageButton lnkDelete = null;

            //  System.Web.UI.WebControls.Panel pnlMovePanel = null;
            LiteralState ls       = (LiteralState)e.Row.DataItem;
            ImageButton  ibUp     = (ImageButton)e.Row.FindControl("ibUp");
            ImageButton  ibDown   = (ImageButton)e.Row.FindControl("ibDown");
            Label        lblLabel = (Label)e.Row.FindControl("lblLabel");


            // UCSF, no need to move up and down if you can only have one
            if ("1".Equals(MaxCardinality))
            {
                if (ibUp != null)
                {
                    ibUp.Visible = false;
                }
                if (ibDown != null)
                {
                    ibDown.Visible = false;
                }
            }


            LiteralState literalstate = null;

            if (e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Cells[0].Text = PropertyLabel;
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                lnkEdit   = (ImageButton)e.Row.Cells[1].FindControl("lnkEdit");
                lnkDelete = (ImageButton)e.Row.Cells[1].FindControl("lnkDelete");
                // pnlMovePanel = (System.Web.UI.WebControls.Panel)e.Row.Cells[2].FindControl("pnlMovePanel");


                literalstate = (LiteralState)e.Row.DataItem;

                if (literalstate.EditDelete == false)
                {
                    lnkDelete.Visible = false;
                }
                if (literalstate.EditExisting == false)
                {
                    lnkEdit.Visible = false;
                    //     pnlMovePanel.Visible = false;
                }
                else
                {
                    if (ibUp != null)
                    {
                        ibUp.CommandArgument = ls.Subject.ToString();
                    }
                }

                if (lnkDelete != null)
                {
                    lnkDelete.OnClientClick = "Javascript:return confirm('Are you sure you want to delete this " + PropertyLabel + "?');";
                }

                if (lblLabel != null)
                {
                    lblLabel.Text = literalstate.Literal.Replace("\n", "<br/>");
                }
            }

            if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
            {
                txtLabel      = (TextBox)e.Row.Cells[0].FindControl("txtLabel");
                txtLabel.Text = literalstate.Literal.Trim();
            }
        }
        protected void GridViewProperty_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            TextBox txtLabel = null;

            ImageButton lnkEdit   = null;
            ImageButton lnkDelete = null;

            //  System.Web.UI.WebControls.Panel pnlMovePanel = null;
            LiteralState ls       = (LiteralState)e.Row.DataItem;
            ImageButton  ibUp     = (ImageButton)e.Row.FindControl("ibUp");
            ImageButton  ibDown   = (ImageButton)e.Row.FindControl("ibDown");
            Label        lblLabel = (Label)e.Row.FindControl("lblLabel");


            LiteralState literalstate = null;

            if (e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Cells[0].Text = PropertyLabel;
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                lnkEdit   = (ImageButton)e.Row.Cells[1].FindControl("lnkEdit");
                lnkDelete = (ImageButton)e.Row.Cells[1].FindControl("lnkDelete");
                // pnlMovePanel = (System.Web.UI.WebControls.Panel)e.Row.Cells[2].FindControl("pnlMovePanel");


                literalstate = (LiteralState)e.Row.DataItem;

                if (literalstate.EditDelete == false)
                {
                    lnkDelete.Visible = false;
                }
                if (literalstate.EditExisting == false)
                {
                    lnkEdit.Visible = false;
                    //     pnlMovePanel.Visible = false;
                }
                else
                {
                    if (ibUp != null)
                    {
                        ibUp.CommandArgument = ls.Subject.ToString();
                    }
                }

                if (lnkDelete != null)
                {
                    lnkDelete.OnClientClick = "Javascript:return confirm('Are you sure you want to delete this " + PropertyLabel + "?');";
                }

                if (lblLabel != null)
                {
                    lblLabel.Text = "<a href=\"" + Profiles.ORCID.Utilities.config.ORCID_URL + "/" + literalstate.Literal + "\" >" + literalstate.Literal + "</a>";
                }
            }

            if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit)
            {
                txtLabel      = (TextBox)e.Row.Cells[0].FindControl("txtLabel");
                txtLabel.Text = literalstate.Literal.Trim();
            }
        }