public override async Task ProcessAsync(TagHelperContext tagContext, TagHelperOutput output) { output.SuppressOutput(); if (tagContext.Items.ContainsKey(typeof(NccRepeaterContext))) { _context = (NccRepeaterContext)tagContext.Items[typeof(NccRepeaterContext)]; } else { return; } var childContent = await output.GetChildContentAsync(); _nccTagContext.RepeaterHeader = childContent.GetContent(); }
public override async Task ProcessAsync(TagHelperContext tagContext, TagHelperOutput output) { output.SuppressOutput(); if (tagContext.Items.ContainsKey(typeof(NccRepeaterContext))) { _context = (NccRepeaterContext)tagContext.Items[typeof(NccRepeaterContext)]; } else { return; } var gridViewContext = (NccRepeaterContext)tagContext.Items[typeof(NccRepeaterContext)]; var data = gridViewContext.DataObjects.GetType().ToString().Contains("Microsoft.EntityFrameworkCore.Internal.InternalDbSet") || gridViewContext.DataObjects.GetType().ToString().Contains("Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable") ? ((IQueryable <object>)gridViewContext.DataObjects).ToList() : gridViewContext.DataObjects as IList; if (data != null && data.Count > 0) { object service = null; if (!string.IsNullOrEmpty(_context.EventHandlerClass)) { service = NccReflectionService.NccGetClassInstance(_context.EventHandlerClass, null); } foreach (var item in data) { service?.NccInvokeMethod(NccRepeaterEventsEnum.ItemDataBound.ToString(), new object[] { new NccEventArgs { NccTagContext = _nccTagContext, NccControlContext = _context, DataObjects = data }, item }); var itemData = item.NccToExpando() as IDictionary <string, object>; ViewContext.ViewData.Model = itemData.ExtToExpandoObject(); var childContent = await output.GetChildContentAsync(false); _nccTagContext.RepeaterItems.Add(childContent.GetContent()); } } }