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.
Example
")
)
ButtonsTemplate(Kendo.Mvc.UI.TemplateBuilder)
Specifies the template which is used for rendering the From buttons.
Parameters
template - TemplateBuilder<T>
The value that configures the buttons template.
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.
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
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.
Example
@(Html.Kendo().Form()
.Name("form")
.FocusFirst(true)
)
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
Expression(System.String)
Sets the name of the component.
Parameters
modelExpression - System.String
Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)
Sets the name of the component.
Parameters
modelExplorer - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
Name(System.String)
Sets the name of the component.
Parameters
componentName - System.String
The name.
Deferred(System.Boolean)
Suppress initialization script rendering. Note that this options should be used in conjunction with
Parameters
deferred - System.Boolean
HtmlAttributes(System.Object)
Sets the HTML attributes.
Parameters
attributes - System.Object
The HTML attributes.
HtmlAttributes(System.Collections.Generic.IDictionary)
Sets the HTML attributes.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The HTML attributes.
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.
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.
Render()
Renders the component in place.
ToHtmlString()
WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)
Parameters
writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder
ToClientTemplate()
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.