public override IEnumerable <IGridButtonBuilder> CreateDisplayButtons(IGridUrlBuilder urlBuilder, IGridHtmlHelper htmlHelper)
        {
            var button = CreateButton <GridLinkButtonBuilder>(Text, CssClass());

            button.Url = (dataItem) =>
            {
                var navigatable = new RequestSettings
                {
                    ActionName     = ActionName,
                    ControllerName = ControllerName,
                };

                navigatable.RouteValues.AddRange(RouteValues);

                var dataRouteValues = DataRouteValues.Cast <IDataKey>();

                if (SendDataKeys)
                {
                    dataRouteValues = dataRouteValues.Concat(urlBuilder.GetDataKeys());
                }

                foreach (var key in dataRouteValues)
                {
                    navigatable.RouteValues.Add(key.RouteKey, key.GetValue(dataItem));
                }

                return(urlBuilder.Url(navigatable, SendState));
            };

            return(new [] { button });
        }
        public override IDictionary <string, object> Serialize(IGridUrlBuilder urlBuilder)
        {
            var state = base.Serialize(urlBuilder);

            if (Text.HasValue())
            {
                state["text"] = Text;
            }

            if (SendState && !Ajax)
            {
                RouteValues.AddRange(urlBuilder.GetState());
            }

            var dataRouteValues = DataRouteValues.Cast <IGridDataKey>();

            if (Ajax)
            {
                state["ajax"] = true;
            }

            if (SendDataKeys)
            {
                dataRouteValues = dataRouteValues.Concat(urlBuilder.GetDataKeys());
            }

            foreach (var route in dataRouteValues)
            {
                RouteValues[route.RouteKey] = "<#=" + route.Name + "#>";
            }

            state["url"] = urlBuilder.Url(this);

            return(state);
        }