This is a migrated thread and some comments may be shown as answers.

[Solved] Trying to filter on a field that is not in the grid but in the model

0 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
skyhikeeper
Top achievements
Rank 1
skyhikeeper asked on 02 Apr 2011, 07:46 PM
This is my grid

<% Html.Telerik().Grid<HealthMVC.Models.ClientMappingModel>()
		.Name("ClientMaps")
		.DataKeys(k => k.Add(c => c.ID))
		.ToolBar(commands =>
		{
			commands.Insert();
		})
		.Columns(columns =>
		{
            columns.Bound(c => c.ID).Title("RecID").Visible(false).Filterable(false);
            columns.Bound(c => c.UserID).Title("User").Width(300).ClientTemplate("<#= UserName #>").Filterable(false);
            columns.Bound(c => c.ClientID).Title("Client").Width(300).ClientTemplate("<#= ClientName #>").Filterable(false);
			columns.Command(commands =>
			{
                commands.Edit();
				commands.Delete();
			});
		})
		.DataBinding(databinding => databinding.Ajax()
			.Select("SelectAjaxEditing""JISClientHealth")
            .Update("UpdateAjaxEditing""JISClientHealth")
			.Insert("CreateAjaxEditing""JISClientHealth")
			.Delete("RemoveAjaxEditing""JISClientHealth")
			)
		.Editable(editing => editing.Mode(GridEditMode.InLine ))
        .Pageable(pager => pager.Style(GridPagerStyles.NextPreviousAndNumeric | GridPagerStyles.PageSizeDropDown).PageSize(20, new int[] { 10, 20, 50, 100 }))
		.Sortable()
        .Groupable()
        .Filterable(filtering => filtering
            .Filters(filters => filters
                .Add(c => c.UserName).StartsWith("tj")
            )
        )
		.Render();
	%>

If I add the column into the grid the filter works, but this field is only there for display purposes because of the updating using a dropdown, is there any way that this can be the filter or should i look for another way to do it

Terence

Tags
General Discussions
Asked by
skyhikeeper
Top achievements
Rank 1
Share this question
or