protected void OnBtnSaveClicked(object sender, EventArgs e)
    {
        ParamLegalFormRepository repo = new ParamLegalFormRepository();

        ParamLegalForm saveItem = new ParamLegalForm();
        saveItem.FormID = txtFormID.Text;

        if (Request.QueryString["FormID"] == null)
        {
            ParamLegalForm oldItem = repo.FindOne(saveItem);
            if (oldItem != null)
            {
                string message = ResourceManager.GetString("itemAlreadyExist");
                string script1 = "<script type=\"text/javascript\">";
                script1 += " alert(\"" + message + "\");";
                script1 += " </script>";

                if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
                    ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script1);
            }
            else
            {
                repo.Insert(saveItem);
            }
        }
        else
        {
            repo.UpdateLegalForm(txtFormID.Text, Request.QueryString["FormID"]);
        }

        string script = "<script type=\"text/javascript\">";
        script += " OnBtnSaveClientClicked();";
        script += " </script>";

        if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
            ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script);
    }
    protected void OnLegalFormDeleteClicked(object sender, EventArgs e)
    {
        LinkButton lnkItem = (LinkButton)sender;
        string formID = lnkItem.CommandArgument;

        ParamLegalForm deleteItem = new ParamLegalForm(formID);
        ParamLegalFormRepository repo = new ParamLegalFormRepository();
        repo.Delete(deleteItem);

        BindGridData();
        gridLegalForm.DataBind();
    }