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

        ParamContactFunction saveItem = new ParamContactFunction();
        saveItem.FunctionName = txtFunction.Text.Trim();
        saveItem.LogicalOrder = txtLogicalOrder.Text.Trim();

        if (string.IsNullOrEmpty(Request.QueryString["ContactFunctionID"]))
        {
            repo.Insert(saveItem);
        }
        else
        {
            saveItem.ContactFunctionID = int.Parse(Request.QueryString["ContactFunctionID"]);
            repo.Update(saveItem);
        }

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

        if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
            ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script);
    }
    protected void OnContactFunctionDeleteClicked(object sender, EventArgs e)
    {
        LinkButton lnkItem = (LinkButton)sender;
        int contactFunctionID = int.Parse(lnkItem.CommandArgument);

        ParamContactFunction deleteItem = new ParamContactFunction(contactFunctionID);
        ParamContactFunctionRepository repo = new ParamContactFunctionRepository();
        repo.Delete(deleteItem);

        BindGridData();
        gridContactFunction.DataBind();
    }