Home Ask Login Register

Developers Planet

Your answer is one click away!

Jeff Finn February 2016

In .Net MVCGrid I'm unable to pass additional query options using client side bindings

Hi I have a grid that I need to send values to the RetrieveDataMethod. I am using 2 drop down menus like filters but because the menus don't relate directly to the columns in my grid I can't use the filter option.

I really like the Idea of using the client side binding because it is clean and avoids me needing to write any jquery.

The code for my grid is

public static MVCGridBuilder<Batch> BuildGrid(GridDefaults gridDefaults, ColumnDefaults columnDefaults)
        return new MVCGridBuilder<Batch>(gridDefaults, columnDefaults)
            .AddColumns(cols =>
                    .WithHeaderText("Batch Id")
                    .WithValueExpression(p => p.BatchId.Trim());
                cols.Add("PartNumber").WithHeaderText("Part Number")
                    .WithValueExpression(p => p.PartNumber.Trim());
                    .WithHeaderText("Adjusted Qty")
                    .WithValueExpression((p, c) => c.UrlHelper.Action("AdjustBatchQuantity", "Batch"))
                    .WithValueTemplate("<a href='#' id='AdjustedQty' style='display: inline;' data-type='text' data-pk='{Model.BatchId}' data-url='AdjustBatchQuantity' data-title='Adjust Quantity' class='editable editable-click' >{Model.AdjustedQty}</a>");
                    .WithHeaderText("Update Date")
                    .WithValueExpression(p => p.UpdateDate.ToShortDateString());
            .WithAdditionalQueryOptionNames("FamilyId", "ColorId")
            .WithAdditionalSetting("RenderLoadingDiv", true)
            .WithRetrieveDataMethod(context =>
                var options = context.Que        


Jeff Finn February 2016

My bad, I had removed


and placed it in my bundle config, but it didn't seem to work there.

Post Status

Asked in February 2016
Viewed 2,517 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life