Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9048369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:08:25+00:00 2026-06-16T12:08:25+00:00

I have a grid which is filtered by another area on the page. I’ve

  • 0

I have a grid which is filtered by another area on the page. I’ve already figured out how to pass the filter arguments to filter grid columns via javascript/ajax. However, I want to pass custom filter arguments (that don’t have a column) to do additional filtering server-side.

In my case, a user can have 0:M roles. I’m not showing the roles in the KendoUI Grid, however I want to select 0:M roles in a multiselct box and pass the selections to the grid’s filter call so that I can use the values server side in my stored proc. Anyone know how to do this? This is my current setup.

@using (Html.BeginForm()) {
@Html.ValidationSummary(true)

<fieldset>
    <legend>Account Filter</legend>

    <table>
        <tr>
            <td style="vertical-align: top;">
                <div class="editor-label">
                    <label>User Name:</label>
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.UserName)
                    @Html.ValidationMessageFor(model => model.UserName)
                </div>

                <div class="editor-label">
                    <label>Email:</label>
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.PrimaryEmailAddress)
                    @Html.ValidationMessageFor(model => model.PrimaryEmailAddress)
                </div>

                <p>
                    <input type="button" id="btnFilter" value="Filter" />
                </p>
            </td>
            <td>&nbsp;</td>
            <td style="vertical-align: top;">
                <div class="editor-label">
                    <label>Role(s):</label>
                </div>
                <div class="editor-field">
                    @Html.DropDownListFor(model => model.RolesList, Model.RolesList, null, htmlAttributes: new { id="ddlTimeZones", multiple="multiple" })
                    @Html.ValidationMessageFor(model => model.RolesList)
                </div>
            </td>
        </tr>

    </table>
</fieldset>
}

<div style="margin-top: 10px;">
@(Html.Kendo().Grid<AccountGridModel>()    
    .Name("grdAccounts")
    .Columns(columns =>
    {
        columns.Bound(m => m.UserId);
        columns.Bound(m => m.UserName);
        columns.Bound(m => m.FirstName);
        columns.Bound(m => m.LastName);
        columns.Bound(m => m.PrimaryEmailAddress);
    })
    .Groupable(grouping => grouping
        .Enabled(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(m => m.UserId))
        .Events(events => events.Error("error_handler"))
        .Read(read => read.Action("Index", "Accounts"))
        .Sort(sort => sort.Add(m => m.UserName).Ascending())
        .PageSize(20))
    .Filterable(filtering => filtering
        .Enabled(false))
    .Pageable(paging => paging
        .Enabled(true)
        .Info(true)
        .PageSizes(false)
        .Refresh(true))
    .Scrollable(scrolling => scrolling
        .Enabled(false)
        .Height(400)
        .Virtual(false))
    .Sortable(sorting => sorting
        .Enabled(true)
        .AllowUnsort(false)
        .SortMode(GridSortMode.SingleColumn)))
</div>

@section Scripts {
@Scripts.Render("~/bundles/jqueryval")

<script type="text/javascript">
    $("#btnFilter").click(function () {
        //var dateFrom = $("#dpDateFrom").data("kendoDatePicker").value();
        var userName = $("#UserName").val();
        var primaryEmail = $("#PrimaryEmailAddress").val();

        var grid = $("#grdAccounts").data("kendoGrid");

        grid.dataSource.filter({
            logic: "and",
            filters: [
                { field: 'UserName', operator: 'contains', value: userName },
                { field: 'PrimaryEmailAddress', operator: 'contains', value: primaryEmail },
                { field: 'RoleIdList', operator: 'contains', value: '1,2,3,4' } //this errors... no column
            ]
        });
    });
</script>
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:08:27+00:00Added an answer on June 16, 2026 at 12:08 pm

    Thanks to Pechka for starting me in the right direction. You can pass additional values to your controller via the Read.Data javascript function shown below.

    <div style="margin-top: 10px;">
    @(Html.Kendo().Grid<AccountGridModel>()    
        .Name("grdAccounts")
        .Columns(columns =>
        {
            columns.Bound(m => m.UserId);
            columns.Bound(m => m.UserName).Filterable(false);
            columns.Bound(m => m.FirstName);
            columns.Bound(m => m.LastName);
            columns.Bound(m => m.PrimaryEmailAddress).Filterable(false);
        })
        .Groupable(grouping => grouping
            .Enabled(true))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Model(model => model.Id(m => m.UserId))
            .Events(events => events.Error("error_handler"))
            .Read(read => read.Action("Index", "Accounts").Data("additionalData"))
            .Sort(sort => sort.Add(m => m.UserName).Ascending())
            .PageSize(20))
        .Filterable(filtering => filtering
            .Enabled(true))
        .Pageable(paging => paging
            .Enabled(true)
            .Info(true)
            .PageSizes(false)
            .Refresh(true))
        .Scrollable(scrolling => scrolling
            .Enabled(false)
            .Height(400)
            .Virtual(false))
        .Sortable(sorting => sorting
            .Enabled(true)
            .AllowUnsort(false)
            .SortMode(GridSortMode.SingleColumn)))
    </div>
    
    @section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    
    <script type="text/javascript">
        function additionalData() {
            var userName = $("#UserName").val();
            var primaryEmailAddress = $("#PrimaryEmailAddress").val();
            var roleIdList = "";
    
            var selMulti = $.map($("#RolesList option:selected"), function (el, i) {
                return $(el).val();
            });
            roleIdList = selMulti.join(",");
    
            return {
                userName: userName,
                primaryEmailAddress: primaryEmailAddress,
                roleIdList: roleIdList
            };
        }
    
        $("#btnFilter").click(function () {
            var grid = $("#grdAccounts").data("kendoGrid");
            grid.dataSource.read();
        });
    </script>
    }
    

    Then, in your controller, add variables to your POST function like so:

            //
        // POST: /Admin/Accounts/
    
        [HttpPost]
        public ActionResult Index([DataSourceRequest] DataSourceRequest request, string userName, string primaryEmailAddress, string roleIdList)
        {
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid which has 4 bands and the columns in band[3] are
I have a Grid which contains an Image in one of its columns. The
I have grid with some textboxes and an image which goes out of grid
I have a grid which has a link to next page and I have
I have some grid which use form edit. But after edit success then page
I have a query which i am using to filter the grid SELECT *
I have grid view which contains five radio buttons per row. Out of these
I have a grid view which contains 10 rows and 3 columns.. Now i
I have a Grid View which works, the data bound columns extract the proper
I have grid in index page and i have another grid in Data page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.