private void CatDefaultDataBind(object sender, EventArgs e)
        {
            var lc = (Literal)sender;
            var name = lc.Text;
            lc.Text = "";
            var container = (IDataItemContainer)lc.NamingContainer;
            try
            {
                lc.Visible = visibleStatus.DefaultIfEmpty(true).First();
                var moduleId = DataBinder.Eval(container.DataItem, "ModuleId");
                var id = Convert.ToString(DataBinder.Eval(container.DataItem, "ItemId"));
                var lang = Convert.ToString(DataBinder.Eval(container.DataItem, "lang"));

                if (Utils.IsNumeric(id) && Utils.IsNumeric(moduleId))
                {
                    var moduleKey = "";
                    // if we have no catid in url, we're going to need a default category from module.
                    var settings = new System.Collections.Hashtable();
                    var modSettings = new ModSettings(Convert.ToInt32(moduleId), settings);
                    moduleKey = modSettings.Get("modulekey");

                    var grpCatCtrl = new GrpCatController(Utils.GetCurrentCulture());
                    var objCInfo = grpCatCtrl.GetCurrentCategoryData(PortalSettings.Current.PortalId, lc.Page.Request, Convert.ToInt32(id), modSettings.Settings(), moduleKey);
                    if (objCInfo != null)
                    {
                        GroupCategoryData objPcat;
                        switch (name.ToLower())
                        {
                            case "categorydesc":
                                lc.Text = objCInfo.categorydesc;
                                break;
                            case "message":
                                lc.Text = System.Web.HttpUtility.HtmlDecode(objCInfo.message);
                                break;
                            case "archived":
                                lc.Text = objCInfo.archived.ToString(CultureInfo.InvariantCulture);
                                break;
                            case "breadcrumb":
                                lc.Text = objCInfo.breadcrumb;
                                break;
                            case "categoryid":
                                lc.Text = objCInfo.categoryid.ToString("");
                                break;
                            case "categoryname":
                                lc.Text = objCInfo.categoryname;
                                break;
                            case "categoryref":
                                lc.Text = objCInfo.categoryref;
                                break;
                            case "depth":
                                lc.Text = objCInfo.depth.ToString("");
                                break;
                            case "disabled":
                                lc.Text = objCInfo.disabled.ToString(CultureInfo.InvariantCulture) ;
                                break;
                            case "entrycount":
                                lc.Text = objCInfo.entrycount.ToString("");
                                break;
                            case "grouptyperef":
                                lc.Text = objCInfo.grouptyperef;
                                break;
                            case "imageurl":
                                lc.Text = objCInfo.imageurl;
                                break;
                            case "ishidden":
                                lc.Text = objCInfo.ishidden.ToString(CultureInfo.InvariantCulture);
                                break;
                            case "isvisible":
                                lc.Text = objCInfo.isvisible.ToString(CultureInfo.InvariantCulture) ;
                                break;
                            case "metadescription":
                                lc.Text = objCInfo.metadescription;
                                break;
                            case "metakeywords":
                                lc.Text = objCInfo.metakeywords;
                                break;
                            case "parentcatid":
                                lc.Text = objCInfo.parentcatid.ToString("");
                                break;
                            case "parentcategoryname":
                                objPcat = grpCatCtrl.GetCategory(objCInfo.parentcatid);
                                lc.Text = objPcat.categoryname;
                                break;
                            case "parentcategoryref":
                                objPcat = grpCatCtrl.GetCategory(objCInfo.parentcatid);
                                lc.Text = objPcat.categoryref;
                                break;
                            case "parentcategorydesc":
                                objPcat = grpCatCtrl.GetCategory(objCInfo.parentcatid);
                                lc.Text = objPcat.categorydesc;
                                break;
                            case "parentcategorybreadcrumb":
                                objPcat = grpCatCtrl.GetCategory(objCInfo.parentcatid);
                                lc.Text = objPcat.breadcrumb;
                                break;
                            case "parentcategoryguidkey":
                                objPcat = grpCatCtrl.GetCategory(objCInfo.parentcatid);
                                lc.Text = objPcat.categoryrefGUIDKey;
                                break;
                            case "recordsortorder":
                                lc.Text = objCInfo.recordsortorder.ToString("");
                                break;
                            case "seoname":
                                lc.Text = objCInfo.seoname;
                                if (lc.Text == "") lc.Text = objCInfo.categoryname;
                                break;
                            case "seopagetitle":
                                lc.Text = objCInfo.seopagetitle ;
                                break;
                            case "url":
                                lc.Text = objCInfo.url ;
                                break;
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                lc.Text = ex.ToString();
            }
        }
        private void CatDefaultNameDataBind(object sender, EventArgs e)
        {
            var lc = (Literal)sender;
            var container = (IDataItemContainer)lc.NamingContainer;
            try
            {
                lc.Visible = visibleStatus.DefaultIfEmpty(true).First();
                var moduleId = DataBinder.Eval(container.DataItem, "ModuleId");
                var id = Convert.ToString(DataBinder.Eval(container.DataItem, "ItemId"));
                var lang = Convert.ToString(DataBinder.Eval(container.DataItem, "lang"));

                if (Utils.IsNumeric(id) && Utils.IsNumeric(moduleId))
                {
                    var grpCatCtrl = new GrpCatController(Utils.GetCurrentCulture());
                    var objCInfo = grpCatCtrl.GetCurrentCategoryData(PortalSettings.Current.PortalId, lc.Page.Request, Convert.ToInt32(id));
                    if (objCInfo != null)
                    {
                        lc.Text = objCInfo.categoryname;
                    }
                }

            }
            catch (Exception ex)
            {
                lc.Text = ex.ToString();
            }
        }
        private void CatBreadCrumbDataBind(object sender, EventArgs e)
        {
            var lc = (Literal)sender;
            var container = (IDataItemContainer)lc.NamingContainer;
            try
            {
                var grpCatCtrl = new GrpCatController(Utils.GetCurrentCulture());

                lc.Visible = visibleStatus.DefaultIfEmpty(true).First();

                if (visibleStatus.DefaultIfEmpty(true).First())
                {

                    var xmlDoc = new XmlDocument();
                    xmlDoc.LoadXml("<root>" + lc.Text + "</root>");
                    var xmlNod = xmlDoc.SelectSingleNode("root/tag");

                    var catid = -1;
                    if (container.DataItem is NBrightInfo)
                    {
                        // Must be displaying a product or category with (NBrightInfo), so get categoryid
                        var objCInfo = (NBrightInfo) container.DataItem;
                        if (String.IsNullOrEmpty(objCInfo.TypeCode) || objCInfo.TypeCode == "PRD") // no type is list header, so use catid in url if there.
                        {
                            //Is product so get categoryid
                            var id = Convert.ToString(DataBinder.Eval(container.DataItem, "ItemId"));
                            var targetModuleKey = "";
                            if (xmlNod != null && xmlNod.Attributes != null && xmlNod.Attributes["targetmodulekey"] != null) targetModuleKey = xmlNod.Attributes["targetmodulekey"].InnerText;
                            var obj = grpCatCtrl.GetCurrentCategoryData(PortalSettings.Current.PortalId, lc.Page.Request, Convert.ToInt32(id), _settings, targetModuleKey);
                            if (obj != null) catid = obj.categoryid;
                        }
                        else if (objCInfo.TypeCode == "CATEGORYLANG") // no type is list header, so use catid in url if there.
                        {
                            catid = objCInfo.ParentItemId;

                        }
                        else
                        {
                            catid = objCInfo.ItemID;
                        }
                    }

                    if (container.DataItem is GroupCategoryData)
                    {
                        // GroupCategoryData class, so use categoryid
                        var id = Convert.ToString(DataBinder.Eval(container.DataItem, "categoryid"));
                        if (Utils.IsNumeric(id)) catid = Convert.ToInt32(id);
                    }

                    var intLength = 400;
                    var intShortLength = -1;
                    var isLink = false;
                    var separator = ">";
                    var aslist = false;

                    if (xmlNod != null && xmlNod.Attributes != null)
                    {
                        if (xmlNod.Attributes["length"] != null)
                        {
                            if (Utils.IsNumeric(xmlNod.Attributes["length"].InnerText))
                            {
                                intLength = Convert.ToInt32(xmlNod.Attributes["length"].InnerText);
                            }
                        }
                        if (xmlNod.Attributes["links"] != null) isLink = true;
                        if (xmlNod.Attributes["short"] != null)
                        {
                            if (Utils.IsNumeric(xmlNod.Attributes["short"].InnerText))
                            {
                                intShortLength = Convert.ToInt32(xmlNod.Attributes["short"].InnerText);
                            }
                        }
                        if (xmlNod.Attributes["separator"] != null) separator = xmlNod.Attributes["separator"].InnerText;
                        if (xmlNod.Attributes["aslist"] != null && xmlNod.Attributes["aslist"].InnerText.ToLower() == "true") aslist = true;
                    }

                    if (catid > 0) // check we have a catid
                    {
                        if (isLink)
                        {
                            var defTabId = PortalSettings.Current.ActiveTab.TabID;
                            if (_settings.ContainsKey("ddllisttabid") && Utils.IsNumeric(_settings["ddllisttabid"])) defTabId = Convert.ToInt32(_settings["ddllisttabid"]);
                            lc.Text = grpCatCtrl.GetBreadCrumbWithLinks(catid, defTabId, intShortLength, separator, aslist);
                        }
                        else
                        {
                            lc.Text = grpCatCtrl.GetBreadCrumb(catid, intShortLength, separator, aslist);
                        }

                        if ((lc.Text.Length > intLength) && (!aslist))
                        {
                            lc.Text = lc.Text.Substring(0, (intLength - 3)) + "...";
                        }
                    }
                }
            }
            catch (Exception)
            {
                lc.Text = "";
            }
        }