protected void rtbFormButtons_OnButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Value)
            {
            case "LeadForce":
                Response.Redirect(UrlsData.AP_SiteActivityRuleAdd((int)RuleType.Form));
                break;

            case "Wizard":
                Response.Redirect(UrlsData.AP_FormWizard());
                break;

            case "External":
                Response.Redirect(UrlsData.AP_SiteActivityRuleAdd((int)RuleType.ExternalForm));
                break;

            case "Wufoo":
                if (!Page.ClientScript.IsStartupScriptRegistered("AddWufooForm"))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "AddWufooForm", "AddWufooForm();", true);
                }
                break;

            case "LPgenerator":
                Response.Redirect(UrlsData.AP_SiteActivityRuleAdd((int)RuleType.LPgenerator));
                break;
            }
        }
        /// <summary>
        /// Handles the OnItemDataBound event of the gridSiteActivityRules control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gridSiteActivityRules_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                ((HyperLink)item.FindControl("spanName")).Text = data["tbl_SiteActivityRules_Name"].ToString();

                ((Literal)item.FindControl("lType")).Text = data["tbl_RuleTypes_Title"].ToString();

                ((HyperLink)item.FindControl("urlLink")).Text = data["tbl_SiteActivityRules_URL"].ToString();
                if (!string.IsNullOrEmpty(((HyperLink)item.FindControl("urlLink")).Text))
                {
                    ((HyperLink)item.FindControl("urlLink")).NavigateUrl = ((HyperLink)item.FindControl("urlLink")).Text;
                }
                else
                {
                    item.FindControl("spanUrl").Visible = false;
                }

                ((Literal)item.FindControl("lDescription")).Text = data["tbl_SiteActivityRules_Description"].ToString();

                var lbCopy = (LinkButton)e.Item.FindControl("lbCopy");
                lbCopy.CommandArgument = data["ID"].ToString();
                lbCopy.Command        += new CommandEventHandler(lbCopy_OnCommand);


                var lbDelete = (LinkButton)e.Item.FindControl("lbDelete");
                lbDelete.CommandArgument = data["ID"].ToString();
                lbDelete.Command        += new CommandEventHandler(lbDelete_OnCommand);

                if ((RuleType)int.Parse(data["tbl_SiteActivityRules_RuleTypeID"].ToString()) == RuleType.Form)
                {
                    ((LinkButton)item.FindControl("lbGetScript")).OnClientClick =
                        string.Format("openRadWindow('{0}'); return false;", data["tbl_SiteActivityRules_Code"].ToString());
                    ((LinkButton)item.FindControl("lbGetScript")).Visible = true;
                }

                if ((RuleType)int.Parse(data["tbl_SiteActivityRules_RuleTypeID"].ToString()) == RuleType.WufooForm)
                {
                    ((LinkButton)item.FindControl("lbtnLoadData")).CommandArgument = string.Format("{0}${1}", data["ID"].ToString(),
                                                                                                   !string.IsNullOrEmpty(data["tbl_SiteActivityRules_WufooRevisionDate"].ToString()) ?
                                                                                                   DateTime.Parse((data["tbl_SiteActivityRules_WufooRevisionDate"].ToString())).ToString("yyyy-MM-dd HH:mm:ss") : "");
                    item.FindControl("lbtnLoadData").Visible = true;
                }

                var allowOwnForm = ((LeadForceBasePage)Page).CurrentModuleEditionOptions.SingleOrDefault(a => a.SystemName == "AllowOwnForm");
                if (int.Parse(data["tbl_SiteActivityRules_RuleTypeID"].ToString()) != (int)RuleType.ExternalForm && allowOwnForm == null && !((LeadForceBasePage)Page).IsDefaultEdition)
                {
                    ((HyperLink)item.FindControl("hlEdit")).NavigateUrl   = UrlsData.AP_FormWizard(Guid.Parse(data["ID"].ToString()));
                    ((HyperLink)item.FindControl("spanName")).NavigateUrl = UrlsData.AP_FormWizard(Guid.Parse(data["ID"].ToString()));
                }
                else
                {
                    ((HyperLink)item.FindControl("hlEdit")).NavigateUrl   = UrlsData.AP_SiteActivityRule(Guid.Parse(data["ID"].ToString()), int.Parse(data["tbl_SiteActivityRules_RuleTypeID"].ToString()));
                    ((HyperLink)item.FindControl("spanName")).NavigateUrl = UrlsData.AP_SiteActivityRule(Guid.Parse(data["ID"].ToString()), int.Parse(data["tbl_SiteActivityRules_RuleTypeID"].ToString()));

                    if (int.Parse(data["tbl_SiteActivityRules_RuleTypeID"].ToString()) == (int)RuleType.WufooForm)
                    {
                        lbCopy.Visible = false;
                    }
                }
            }
        }