public static MvcHtmlString RenderPopup(HtmlHelper helper, TypeContext typeContext, RenderPopupMode mode, EntityBase line, bool isTemplate = false) { TypeContext tc = TypeContextUtilities.CleanTypeContext((TypeContext)typeContext); ViewDataDictionary vdd = GetViewData(helper, line, tc); string partialViewName = line.PartialViewName ?? OnPartialViewName(tc); vdd[ViewDataKeys.PartialViewName] = partialViewName; vdd[ViewDataKeys.ViewMode] = !line.ReadOnly; vdd[ViewDataKeys.ViewMode] = ViewMode.View; vdd[ViewDataKeys.ShowOperations] = true; vdd[ViewDataKeys.SaveProtected] = OperationLogic.IsSaveProtected(tc.UntypedValue.GetType()); vdd[ViewDataKeys.WriteEntityState] = !isTemplate && !(tc.UntypedValue is EmbeddedEntity) && ((ModifiableEntity)tc.UntypedValue).Modified == ModifiedState.SelfModified; switch (mode) { case RenderPopupMode.Popup: return helper.Partial(Navigator.Manager.PopupControlView, vdd); case RenderPopupMode.PopupInDiv: return helper.Div(typeContext.Compose(EntityBaseKeys.Entity), helper.Partial(Navigator.Manager.PopupControlView, vdd), "", new Dictionary<string, object> { { "style", "display:none" } }); default: throw new InvalidOperationException(); } }
public static MvcHtmlString RenderPopup(HtmlHelper helper, TypeContext typeContext, RenderPopupMode mode, EntityBase line, bool isTemplate = false) { TypeContext tc = TypeContextUtilities.CleanTypeContext((TypeContext)typeContext); ViewDataDictionary vdd = GetViewData(helper, line, tc); string partialViewName = line.PartialViewName ?? OnPartialViewName(tc); vdd[ViewDataKeys.PartialViewName] = partialViewName; vdd[ViewDataKeys.ViewMode] = !line.ReadOnly; vdd[ViewDataKeys.ViewMode] = ViewMode.View; vdd[ViewDataKeys.ShowOperations] = true; vdd[ViewDataKeys.RequiresSaveOperation] = EntityKindCache.RequiresSaveOperation(tc.UntypedValue.GetType()); vdd[ViewDataKeys.WriteEntityState] = !isTemplate && !(tc.UntypedValue is EmbeddedEntity) && ((ModifiableEntity)tc.UntypedValue).Modified == ModifiedState.SelfModified; switch (mode) { case RenderPopupMode.Popup: return(helper.Partial(Navigator.Manager.PopupControlView, vdd)); case RenderPopupMode.PopupInDiv: return(helper.Div(typeContext.Compose(EntityBaseKeys.Entity), helper.Partial(Navigator.Manager.PopupControlView, vdd), "", new Dictionary <string, object> { { "style", "display:none" } })); default: throw new InvalidOperationException(); } }