Beispiel #1
0
        private void OrderAuditlistDataBind(object sender, EventArgs e)
        {
            var lc = (Literal)sender;
            var container = (IDataItemContainer)lc.NamingContainer;
            try
            {
                var strOut = "";
                lc.Visible = visibleStatus.DefaultIfEmpty(true).First();
                if (lc.Visible)
                {

                    var id = Convert.ToString(DataBinder.Eval(container.DataItem, "ItemId"));
                    var lang = Convert.ToString(DataBinder.Eval(container.DataItem, "lang"));
                    if (lang == "") lang = Utils.GetCurrentCulture();
                    var templName = lc.Text;
                    if (Utils.IsNumeric(id) && (templName != ""))
                    {
                        var buyCtrl = new NBrightBuyController();
                        var rpTempl = buyCtrl.GetTemplateData(-1, templName, lang, _settings, StoreSettings.Current.DebugMode);

                        //remove templName from template, so we don't get a loop.
                        if (rpTempl.Contains(templName)) rpTempl = rpTempl.Replace(templName, "");
                        //build models list

                        var objInfo = (NBrightInfo)container.DataItem;
                        var ordData = new OrderData(objInfo.PortalId, objInfo.ItemID);
                        // render repeater
                        try
                        {
                            var itemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpTempl, _settings, PortalSettings.Current.HomeDirectory, visibleStatus);
                            strOut = GenXmlFunctions.RenderRepeater(ordData.GetAuditItemList(), itemTemplate);
                        }
                        catch (Exception exc)
                        {
                            strOut = "ERROR: NOTE: sub rendered templates CANNOT contain postback controls.<br/>" + exc;
                        }
                    }
                }
                lc.Text = strOut;

            }
            catch (Exception)
            {
                lc.Text = "";
            }
        }