protected void ImgSave_Click(object sender, EventArgs e)
    {
        try
        {
            ImageButton btn             = (ImageButton)sender;
            GridViewRow gvr             = (GridViewRow)btn.NamingContainer;
            Label       ID              = (Label)gvr.FindControl("lblID");
            Label       Key             = (Label)gvr.FindControl("lblKey");
            Label       lbl             = (Label)gvr.FindControl("lblDisplayName");
            TextBox     txt             = (TextBox)gvr.FindControl("txtDisplay");
            ImageButton imgSave         = (ImageButton)gvr.FindControl("ImgSave");
            ImageButton imgCancel       = (ImageButton)gvr.FindControl("ImgCancel");
            ImageButton imgEdit         = (ImageButton)gvr.FindControl("ImgEdit");
            CheckBox    chkConfidential = (CheckBox)gvr.FindControl("chkConfidential");
            CheckBox    chkDisplay      = (CheckBox)gvr.FindControl("chkDisplay");
            chkConfidential.Enabled = true;
            chkDisplay.Enabled      = true;

            if (!string.IsNullOrEmpty(txt.Text.Trim()))
            {
                int i = obj.CRW_UpdateConfigFields(UDFLib.ConvertToInteger(ID.Text), Key.Text.Trim(), txt.Text.Trim());
                if (i > 0)
                {
                    bindGridView();
                    Response.Write("<script type='text/javascript'>");
                    Response.Write("alert('Field has been updated successfully.');");
                    Response.Write("document.location.href='Crew_Details_Configuration.aspx';");
                    Response.Write("</script>");
                    imgEdit.Visible   = true;
                    imgSave.Visible   = false;
                    imgCancel.Visible = false;
                    lbl.Visible       = true;
                    txt.Visible       = false;
                }
                else
                {
                    Response.Write("<script type='text/javascript'>");
                    Response.Write("alert('Field name already exists.');");
                    Response.Write("document.location.href='Crew_Details_Configuration.aspx';");
                    Response.Write("</script>");
                    bindGridView();
                    lbl.Visible       = false;
                    txt.Visible       = true;
                    imgEdit.Visible   = false;
                    imgSave.Visible   = true;
                    imgCancel.Visible = true;
                }
            }
        }
        catch (Exception ex) { UDFLib.WriteExceptionLog(ex); }
    }