FormBuilder
Properties
WriteAction - Func
Methods
ButtonsTemplate(System.String)
Specifies the template which is used for rendering the From buttons.
Parameters
value - System.String
The value that configures the buttons template.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
")
)
ButtonsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)
Specifies the template which is used for rendering the From buttons.
Parameters
template - TemplateBuilder<TModel>
The value that configures the buttons template.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
"))
)
ButtonsTemplateId(System.String)
Specifies the template which is used for rendering the From buttons.
Parameters
value - System.String
The value that configures the buttons template.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form()
.Name("form")
.ButtonsTemplateId("buttonsClientTemplate")
)
ButtonsTemplateView(Microsoft.AspNetCore.Html.IHtmlContent)
Specifies the template which is used for rendering the From buttons.
Parameters
templateView - Microsoft.AspNetCore.Html.IHtmlContent
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form()
.Name("form")
.ButtonsTemplate("templateView")
)
FocusFirst(System.Boolean)
Specifies if the first editor of the form will be focused on initialization.
Parameters
value - System.Boolean
The value that configures the focus first.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form()
.Name("form")
.FocusFirst(true)
)
ClearButton(System.Boolean)
Specifies if the clearButton should be rendered on initialization.
Parameters
value - System.Boolean
The value that configures the clearbutton.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form()
.Name("form")
.ClearButton(false)
)
Orientation(System.String)
Configures the Form orientation. Available options are "horizontal" and "vertical".By default, the Form is rendered with vertical orientation.
Parameters
value - System.String
The value that configures the orientation.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form()
.Name("form")
.Orientation("horizontal")
)
Validatable(System.Action)
Configures the built-in Validator options.
Parameters
configurator - System.Action<FormValidatableSettingsBuilder>
The action that configures the validatable.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form()
.Name("form")
.Validatable(v =>
{
v.ValidateOnBlur(true);
v.ValidationSummary(vs => vs.Enable(false));
})
)
Items(System.Action)
A JavaScript array that contains the Form's items configuration.
Parameters
configurator - System.Action<FormItemFactory>
The action that configures the items.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.FormItemsViewModels>()
.Name("form")
.Items(items =>
{
items.AddGroup()
.Label("Sign up form")
.Items(i =>
{
i.Add()
.Field(f => f.UserID)
.Editor(editor => editor.Hidden());
i.Add()
.Field(f => f.FirstName)
.Label(l => l.Text("First Name:"));
i.Add()
.Field(f => f.Password)
.Label(l => l.Text("Password:"))
.Hint("Hint: enter alphanumeric characters only.")
.EditorTemplateHandler("setPasswordEditor");
i.Add()
.Field(f => f.ComboBox)
.Label(l => l.Text("ComboBox:").Optional(true))
.Editor(e =>
{
e.ComboBox()
.Filter(FilterType.Contains)
.MinLength(3)
.Placeholder("Select...")
.DataTextField("ProductName")
.DataValueField("ProductID")
.Height(520)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Items_GetProducts", "Form").Data("filterProducts");
})
.ServerFiltering(true);
});
});
})
})
)
FormData(System.Object)
An object that provides the initial data for the Form.
Parameters
value - System.Object
The data model object.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.FormItemsViewModels>()
.Name("form")
.FormData(
new FormItemsViewModels
{
UserId = 42,
FirstName = "Antony",
Password = null
})
)
Events(System.Action)
Configures the client-side events.
Parameters
configurator - System.Action<FormEventBuilder>
The client events action.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@( Html.Kendo().Form()
.Name("Form")
.Events(events => events
.Validate("onValidate")
)
)
Size(Kendo.Mvc.UI.ComponentSize)
Sets a value controlling the size of the input.
Parameters
value - ComponentSize
The value for Size
RETURNS
A FormBuilder instance that can be used to configure the Form.
Layout(System.String)
Specify the layout of Form content. Valid options are: grid: This is equivalent to display: grid. It defines the form element as a grid container and establishes a new grid formatting context for its contents..
Parameters
value - System.String
The value that configures the layout.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.FormItemsViewModels>()
.Name("form")
.Layout("grid")
.Grid(g => g.Cols(2).Gutter(20))
)
Grid(System.Action)
Grid layout settings.
Parameters
configurator - System.Action<FormGridSettingsBuilder>
The action that configures the grid.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.FormItemsViewModels>()
.Name("form")
.Layout("grid")
.Grid(g => g.Cols(2).Gutter(20))
)
FormatLabel(System.Func)
Callback function that could be used to change the default format of the automatically generated labels. Takes effect only if the Items option is not specified and labels are being automatically generated.
Parameters
handler - System.Func<Object,Object>
The value that configures the formatlabel action.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.FormItemsViewModels>()
.Name("form")
.FormatLabel(@<text>
function(field){
return field + ":";
}
</text>)
)
FormatLabel(System.String)
Callback function that could be used to change the default format of the automatically generated labels.
Parameters
handler - System.String
The value that configures the formatlabel action.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.FormItemsViewModels>()
.Name("form")
.FormatLabel("formatLabelHandler")
)
Messages(System.Action)
Configures text messages displayed in the Form. Use it to customize or localize the Form messages..
Parameters
configurator - System.Action<FormMessagesSettingsBuilder>
The action that configures the messages.
RETURNS
A FormBuilder instance that can be used to configure the Form.
Example
@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.FormItemsViewModels>()
.Name("form")
.Messages(messages=>{
messages.Submit("Custom Submit Button Text");
messages.Clear("Custom Clear Button Text");
messages.Optional("(Optional field)");
})
)
ToComponent()
Returns the internal view component.
RETURNS
The instance that represents the component.
Expression(System.String)
Sets the name of the component.
Parameters
modelExpression - System.String
RETURNS
Returns the current instance.
Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)
Sets the name of the component.
Parameters
modelExplorer - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
RETURNS
Returns the current instance.
Name(System.String)
Sets the name of the component.
Parameters
componentName - System.String
The name.
RETURNS
Returns the current instance.
Deferred(System.Boolean)
Suppress initialization script rendering. Note that this options should be used in conjunction with
Parameters
deferred - System.Boolean
RETURNS
Returns a DeferredWidgetBuilder instance.
HtmlAttributes(System.Object)
Sets the HTML attributes.
Parameters
attributes - System.Object
The HTML attributes.
RETURNS
Returns the current instance.
HtmlAttributes(System.Collections.Generic.IDictionary)
Sets the HTML attributes.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The HTML attributes.
RETURNS
Returns the current instance.
ScriptAttributes(System.Object,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Object
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
RETURNS
Returns the current instance.
ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
RETURNS
Returns the current instance.
Render()
Renders the component in place.
ToHtmlString()
Returns the HTML representation of the component.
WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)
Parameters
writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder
ToClientTemplate()
Returns the client template for the component.
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.
Parameters
value - System.Boolean
RETURNS
Returns the current instance.