New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Defines the fluent API for configuring the FilterField settings.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

T

Syntax:

C#
public class FilterFieldBuilder<T>

Inheritance: objectFilterFieldBuilder<T>

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initialize the FilterFieldBuilder

C#
public FilterFieldBuilder(FilterField<T> settings)
Parameters:settingsFilterField<T>

The FilterField

Methods

A value which will be initially set as a filter value when an expression item for the specific field is created.

C#
public FilterFieldBuilder<T> DefaultValue(object value)
Parameters:valueobject

The value for DefaultValue

Returns:

FilterFieldBuilder<T>

Example:
C#
@(Html.Kendo().Filter&lt;ProductViewModel&gt;()
.Name("filter")
.Fields(fields =&gt;
{
fields.Add(field =&gt; field.ProductName)
.DefaultValue("Chai");
})
)

The template which the widget will use to create the field editor.

C#
public FilterFieldBuilder<T> EditorTemplate(string value)
Parameters:valuestring

The value that configures the editortemplate.

Returns:

FilterFieldBuilder<T>

The template which the widget will use to create the field editor.

C#
public FilterFieldBuilder<T> EditorTemplateHandler(Func<object, object> value)
Parameters:valueFunc<object, object>

The value for EditorTemplate

Returns:

FilterFieldBuilder<T>

Example:
C#
@(Html.Kendo().Filter&lt;ProductViewModel&gt;()
.Name("filter")
.Fields(fields =&gt;
{
fields.Add(product =&gt; product.ProductName)
.EditorTemplateHandler(@&lt;text&gt;
function editorTemplateHandler(e){
editor template handling code
}
&lt;/text&gt;);
})
)

The template which the widget will use to create the field editor.

C#
public FilterFieldBuilder<T> EditorTemplateHandler(string value)
Parameters:valuestring

The value for EditorTemplate

Returns:

FilterFieldBuilder<T>

Example:
C#
@(Html.Kendo().Filter&lt;ProductViewModel&gt;()
.Name("filter")
.Fields(fields =&gt;
{
fields.Add(field =&gt; field.ProductName)
.EditorTemplateHandler("editorTemplateHandler");
})
)

The template which the widget will use to create the field editor.

C#
public FilterFieldBuilder<T> EditorTemplateId(string value)
Parameters:valuestring

The value that configures the editortemplate.

Returns:

FilterFieldBuilder<T>

The template which the widget will use to create the field editor.

C#
public FilterFieldBuilder<T> EditorTemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The value that configures the editortemplate.

Returns:

FilterFieldBuilder<T>

Defines a value which will be visualized instead of the data feild name.

C#
public FilterFieldBuilder<T> Label(string value)
Parameters:valuestring

The value that configures the label.

Returns:

FilterFieldBuilder<T>

The text of the filter operators displayed in the filter.

C#
public FilterFieldBuilder<T> Operators(Action<FilterOperatorsSettingsBuilder> configurator)
Parameters:configuratorAction<FilterOperatorsSettingsBuilder>

The configurator for the operators setting.

Returns:

FilterFieldBuilder<T>

Example:
C#
@(Html.Kendo().Filter&lt;ProductViewModel&gt;()
.Name("filter")
.Fields(fields =&gt;
{
fields.Add(product =&gt; product.ProductName)
.Label("ProductName")
.Operators(operators =&gt;
{
operators.String(s =&gt;
{
s.Contains("Contains")
.Startswith("Starts with")
.Endswith("Ends with")
.Eq("Equals")
.Neq("Does not equal")
.Isnull("Is null")
.Isnotnull("Is not null")
.Isnotempty("Is not empty")
.Isnullorempty("Is null or empty")
.Isnotnullorempty("Is not null or empty")
.Contains("Contains")
.Doesnotcontain("Does not contain");
});
});
})
)

Sets the format of the value in the preview.

C#
public FilterFieldBuilder<T> PreviewFormat(string value)
Parameters:valuestring

The format.

Returns:

FilterFieldBuilder<T>

Example:
C#
@(Html.Kendo().Filter&lt;ProductViewModel&gt;()
.Name("filter")
.Fields(fields =&gt;
{
fields.Add(field =&gt; field.UnitPrice)
.PreviewFormat("n2");
})
)