protected void gridContactActivity_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                var target = ((LinkButton)item.FindControl("lbtnShowSessionInfo"));
                if (data["tbl_ContactActivity_ContactSessionID"] != null)
                {
                    rttmSessionInfo.TargetControls.Add(target.ClientID, data["tbl_ContactActivity_ContactSessionID"].ToString(), true);
                }

                target.Text = data["tbl_ContactSessions_UserSessionNumber"] != null && !string.IsNullOrEmpty(data["tbl_ContactSessions_UserSessionNumber"].ToString()) ? "Посещение " + data["tbl_ContactSessions_UserSessionNumber"] : "---";

                if (item.FindControl("lContact") != null)
                {
                    if (!string.IsNullOrEmpty(data["tbl_Contact_UserFullName"].ToString()))
                    {
                        ((Literal)item.FindControl("lContact")).Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact(Guid.Parse(data["tbl_Contact_ID"].ToString())), data["tbl_Contact_UserFullName"]);
                    }
                    else
                    {
                        ((Literal)item.FindControl("lContact")).Text = string.Format("&lt;<a href=\"{0}\">Незнакомец</a> от {1}&gt;", UrlsData.AP_Contact(Guid.Parse(data["tbl_Contact_ID"].ToString())), DateTime.Parse(data["tbl_Contact_CreatedAt"].ToString()).ToString("dd.MM.yyyy HH:mm"));
                    }
                }

                if (!string.IsNullOrEmpty(data["tbl_ContactActivity_ActivityCode"].ToString()))
                {
                    switch ((ActivityType)int.Parse(data["tbl_ContactActivity_ActivityTypeID"].ToString()))
                    {
                    case ActivityType.InboxMessage:
                        ((Literal)item.FindControl("lActivityCode")).Text = data["tbl_ContactActivity_ActivityCode"].ToString();
                        break;

                    case ActivityType.ViewPage:
                        ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{0}</a>", Server.UrlDecode(data["tbl_ContactActivity_ActivityCode"].ToString()));
                        break;

                    case ActivityType.Link:
                        ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", Server.UrlDecode(data["tbl_ContactActivity_ActivityCode"].ToString()), Server.UrlDecode(data["tbl_ContactActivity_ActivityCode"].ToString()));
                        break;

                    case ActivityType.OpenForm:
                    case ActivityType.FillForm:
                    case ActivityType.CancelForm:
                        var codeForm = data["tbl_ContactActivity_ActivityCode"].ToString();
                        codeForm = Regex.Replace(codeForm, @"^(.*)(#(.*))$", "$1");

                        var siteActivityRuleForm = dataManager.SiteActivityRules.Select(siteID, codeForm);
                        if (siteActivityRuleForm != null)
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_SiteActivityRule(siteActivityRuleForm.ID, siteActivityRuleForm.RuleTypeID), data["tbl_ContactActivity_ActivityCode"].ToString());
                        }
                        break;

                    case ActivityType.DownloadFile:
                        var siteActivityRule = dataManager.Links.Select(siteID, data["tbl_ContactActivity_ActivityCode"].ToString());
                        if (siteActivityRule != null)
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_SiteActivityRule(siteActivityRule.ID, siteActivityRule.RuleTypeID), siteActivityRule.Code);
                        }
                        break;

                    /*case ActivityType.Event:
                     *  var siteEventTemplate = dataManager.SiteEventTemplates.SelectById(Guid.Parse(data["tbl_ContactActivity_ActivityCode"].ToString()));
                     *  if (siteEventTemplate != null)
                     *      ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_SiteEventTemplate(siteEventTemplate.ID), siteEventTemplate.Title);
                     *  ((Literal)item.FindControl("lActivityCode")).Text = siteEventTemplate.Title;
                     *  break;*/
                    case ActivityType.UserEvent:
                        var workflow = dataManager.WorkflowElement.SelectByValue(data["tbl_ContactActivity_ID"].ToString());
                        if (workflow != null)
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_WorkflowEdit(workflow.WorkflowID), data["tbl_ContactActivity_ActivityCode"]);
                        }
                        else
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = data["tbl_ContactActivity_ActivityCode"].ToString();
                        }
                        break;
                    }
                }
            }
        }