private static string GetParameterValue(this HtmlHelper html, ParameterContext context, IObjectFacade valueNakedObject, bool noFinder) { string value = ""; // Even if not autocomplete add autocomplete menu if no finder and then handle with recently viewed in ajax controller if (context.Parameter.IsAutoCompleteEnabled || (noFinder && !context.Parameter.Specification.IsCollection && !context.IsContributed())) { var htmlAttributes = new RouteValueDictionary(new { title = context.Parameter.Description }); html.AddClientValidationAttributes(context, htmlAttributes); value += html.GetAutoCompleteTextBox(context, htmlAttributes, valueNakedObject); } else if (valueNakedObject != null) { string link = "{0}"; if (context.Parameter.Specification.IsCollection) { link = html.CollectionLink(link, IdConstants.ViewAction, valueNakedObject.Object); } else if (!context.Parameter.Specification.IsParseable && !context.Parameter.Specification.IsCollection) { link = html.ObjectLink(link, IdConstants.ViewAction, valueNakedObject.Object); } string title = html.GetDisplayTitle(context.Parameter, valueNakedObject); value += String.Format(link, title); } if (!noFinder) { // append finder meu value += html.FinderActions(context.Parameter.Specification, context, context.Parameter.Id); } return value; }
private static string GetFieldValue(this HtmlHelper html, ParameterContext context, INakedObject valueNakedObject) { string value = ""; if (context.Parameter.IsAutoCompleteEnabled) { var htmlAttributes = new RouteValueDictionary(new {title = context.Parameter.Description}); html.AddClientValidationAttributes(context, htmlAttributes); value += html.GetAutoCompleteTextBox(context, htmlAttributes, valueNakedObject); } else if (valueNakedObject != null) { string link = "{0}"; if (context.Parameter.Specification.IsCollection) { link = html.CollectionLink(link, IdHelper.ViewAction, valueNakedObject.Object); } else if (!context.Parameter.Specification.IsParseable && context.Parameter.IsObject) { link = html.ObjectLink(link, IdHelper.ViewAction, valueNakedObject.Object); } string title = GetDisplayTitle(context.Parameter, valueNakedObject); value += string.Format(link, title); } return value; }