public static MvcHtmlString SearchControl(this HtmlHelper helper, FindOptions findOptions, Context context, Action<SearchControl> settingsModifier) { var options = new SearchControl { Prefix = context.Prefix }; if (settingsModifier != null) settingsModifier(options); QueryDescription description = DynamicQueryManager.Current.QueryDescription(findOptions.QueryName); Navigator.SetTokens(findOptions.FilterOptions, description, false); Navigator.SetTokens(findOptions.OrderOptions, description, false); Navigator.SetTokens(findOptions.ColumnOptions, description, false); Navigator.Manager.SetSearchViewableAndCreable(findOptions, description); Navigator.Manager.SetDefaultOrder(findOptions, description); var viewData = new ViewDataDictionary(context); viewData[ViewDataKeys.FindOptions] = findOptions; viewData[ViewDataKeys.QueryDescription] = DynamicQueryManager.Current.QueryDescription(findOptions.QueryName); viewData[ViewDataKeys.Title] = helper.ViewData.ContainsKey(ViewDataKeys.Title) ? helper.ViewData[ViewDataKeys.Title] : Navigator.Manager.SearchTitle(findOptions.QueryName); if (!options.ToolBarButton.IsNullOrEmpty()) viewData[ViewDataKeys.ManualToolbarButtons] = options.ToolBarButton; return helper.Partial(Navigator.Manager.SearchControlView, viewData); }