Vi går gladere hjem :)

EVENTS

Submit to our free events

Exception in template (Designs\OBS2\ItemPublisher/List/EventList.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.cdcabe.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System.Web; @{ string selectedEventType = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("EventType")) ? HttpContext.Current.Request.QueryString.Get("EventType") : Translate("All"); var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); var eventTypeField = GetLoop("ItemPublisher:ItemType.Fields").FirstOrDefault((field) => field.GetString("ItemPublisher:ItemType.Field.SystemName") == "EventType"); foreach (var options in eventTypeField.GetLoop("ItemPublisher:ItemType.Field.Options")) { selectedEventType = selectedEventType == options.GetString("ItemPublisher:ItemType.Field.Option.Value") ? options.GetString("ItemPublisher:ItemType.Field.Option.Label") : selectedEventType; } var months = GetLoop("ItemPublisher:Items.List").GroupBy(x => x.GetDate("ItemPublisher:Item.DateAndTime").Month).ToDictionary(y => y.Key, z => z.ToList()); int signUpForEventPageId = GetPageIdByNavigationTag("SignUpForEventPage"); } <div class="grid__col-12"> <div class="grid"> <div class="grid__col-12"> <div class="collection u-no-margin"> <h5>@Translate("Event type")</h5> <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> <div class="dropdown u-w180px dw-mod"> <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@selectedEventType</label> <div class="dropdown__content dw-mod"> @{ query.Set("EventType", ""); <div class="dropdown__item" onclick="window.location = '/Default.aspx?@query.ToString()'">@Translate("All")</div> foreach (var options in eventTypeField.GetLoop("ItemPublisher:ItemType.Field.Options")) { query.Set("EventType", options.GetString("ItemPublisher:ItemType.Field.Option.Value")); <div class="dropdown__item" onclick="window.location = '/Default.aspx?@query.ToString()'">@options.GetString("ItemPublisher:ItemType.Field.Option.Label")</div> } } </div> <label class="dropdown-trigger-off" for="CategorySelector"></label> </div> </div> </div> <div class="grid__col-12"> @foreach (var month in months) { string monthName = new DateTime(2010, month.Key, 1).ToString("MMMM", System.Globalization.CultureInfo.CurrentCulture); <h2 class="grid-caption">@monthName</h2> <div class="u-margin-bottom"> @foreach (var eventInfo in month.Value) { string eventType = eventInfo.GetString("ItemPublisher:Item.EventType"); string signUpLink = ""; string signUpTargetType = "_self"; if (eventInfo.GetString("ItemPublisher:Item.SignUp") == "external") { if (!eventInfo.GetString("ItemPublisher:Item.SignUpLink").Contains("http://")) { signUpLink += "http://" + eventInfo.GetString("ItemPublisher:Item.SignUpLink"); } else { signUpLink = eventInfo.GetString("ItemPublisher:Item.SignUpLink"); } signUpTargetType = "_blank"; } else { signUpLink = "/Default.aspx?Id=" + signUpForEventPageId + "&eventId=" + eventInfo.GetString("ItemPublisher:Item.Field.Id") + "&eventName=" + HttpUtility.UrlEncode(eventInfo.GetString("ItemPublisher:Item.Title")); } <div class="grid__col--line-bottom"> <div class="grid"> <div class="grid__col-sm-3 grid__col--bleed-y"> <a href="/Default.aspx?ID=@eventInfo.GetString("ItemPublisher:Item.Field.PageId")">@eventInfo.GetString("ItemPublisher:Item.Title")</a> </div> <div class="grid__col-sm-1 grid__col--bleed-y"> @eventInfo.GetDate("ItemPublisher:Item.DateAndTime").ToString("MMM. dd") </div> <div class="grid__col-sm-2 grid__col--bleed-y"> @eventType </div> <div class="grid__col-sm-4 grid__col--bleed-y"> @eventInfo.GetString("ItemPublisher:Item.Location.City") @eventInfo.GetString("ItemPublisher:Item.Location.Region") @eventInfo.GetString("ItemPublisher:Item.Location.Country") </div> <div class="grid__col-sm-1 grid__col--bleed-y"> @eventInfo.GetString("ItemPublisher:Item.ParticipationFee") </div> <div class="grid__col-sm-1 grid__col--bleed-y"> <a href="@signUpLink" target="@signUpTargetType">@Translate("Sign up")</a> </div> </div> </div> } </div> } </div> </div> </div>