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

SpreadsheetSheetRowCellValidationSettingsBuilder

Methods

Type(System.String)

Defines the validation type.The supported options are: reject or warning (default).

Parameters

value - System.String

The value that configures the type.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.Type("reject"));
                                    });
                                });
                        })
            )

ComparerType(System.String)

Defines the comparer type that is used to validate the cell value.The supported values are: greaterThan; lessThan; between; equalTo; notEqualTo; greaterThanOrEqualTo; lessThanOrEqualTo; notBetween or custom.

Parameters

value - System.String

The value that configures the comparertype.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.ComparerType("list"));
                                    });
                                });
                        })
            )

DataType(System.String)

Defines the data type of the cell value.The supported values are: date; text; number; list or custom.

Parameters

value - System.String

The value that configures the datatype.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.DataType("custom"));
                                    });
                                });
                        })
            )

From(System.String)

Defines a formula or a value that is used for the comparison process. Used as the only compare value if the comparer type does not require a second argument. Mandatory for validation to work.

Parameters

value - System.String

The value that configures the from.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value(20000)
                                            .Validation(validation => validation.From("DATEVALUE(\"1/1/1990\")"));
                                    });
                                });
                        })
            )

ShowButton(System.Boolean)

A Boolean value which indicates if a button for selecting list items will be displayed (dataType set to list).

Parameters

value - System.Boolean

The value that configures the showbutton.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.ShowButton(true));
                                    });
                                });
                        })
            )

To(System.String)

Defines a formula or a value that is used for the comparison process. Will be used if the comparer type requires a second argument.

Parameters

value - System.String

The value that configures the to.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value(20000)
                                            .Validation(validation => validation.To("DATEVALUE(\"1/1/1998\")"));
                                    });
                                });
                        })
            )

AllowNulls(System.Boolean)

Specifies whether to allow null values.

Parameters

value - System.Boolean

The value that configures the allownulls.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.AllowNulls(true));
                                    });
                                });
                        })
            )

MessageTemplate(System.String)

Defines the hint message that will be displayed if the value is invalid.The template provides access to the following variables: from{0}; to{1}; fromFormula{2}; toFormula{3}; dataType{4}; type{5} or comparerType{6}.

Parameters

value - System.String

The value that configures the messagetemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.MessageTemplate("The name should be longer than 3 letters and shorter than 200."));
                                    });
                                });
                        })
            )

MessageTemplateId(System.String)

Defines the hint message that will be displayed if the value is invalid.The template provides access to the following variables: from{0}; to{1}; fromFormula{2}; toFormula{3}; dataType{4}; type{5} or comparerType{6}.

Parameters

value - System.String

The value that configures the messagetemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.MessageTemplateId("messageTemplate1"));
                                    });
                                });
                        })
            )

MessageTemplateView(System.Web.Mvc.MvcHtmlString)

Defines the hint message that will be displayed if the value is invalid.The template provides access to the following variables: from{0}; to{1}; fromFormula{2}; toFormula{3}; dataType{4}; type{5} or comparerType{6}.

Parameters

value - System.Web.Mvc.MvcHtmlString

The value that configures the messagetemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.MessageTemplateView(Html.Partial("SpreadsheetTemplateView")));
                                    });
                                });
                        })
            )

MessageTemplateHandler(System.String)

Defines the hint message that will be displayed if the value is invalid.The template provides access to the following variables: from{0}; to{1}; fromFormula{2}; toFormula{3}; dataType{4}; type{5} or comparerType{6}.

Parameters

value - System.String

The value that configures the messagetemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.MessageTemplateHandler("templateHandler"));
                                    });
                                });
                        })
            )

MessageTemplate(Kendo.Mvc.UI.TemplateBuilder)

Defines the hint message that will be displayed if the value is invalid.The template provides access to the following variables: from{0}; to{1}; fromFormula{2}; toFormula{3}; dataType{4}; type{5} or comparerType{6}.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the messagetemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.MessageTemplate(Html.Kendo().Template().AddHtml("<b>Invalid value</b>")));
                                    });
                                });
                        })
            )

TitleTemplate(System.String)

Defines the hint title that will be displayed if the value is invalid.

Parameters

value - System.String

The value that configures the titletemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.TitleTemplate("Full Name validation error"));
                                    });
                                });
                        })
            )

TitleTemplateId(System.String)

Defines the hint title that will be displayed if the value is invalid.

Parameters

value - System.String

The value that configures the titletemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.TitleTemplateId("titleTemplate1"));
                                    });
                                });
                        })
            )

TitleTemplateView(System.Web.Mvc.MvcHtmlString)

Defines the hint title that will be displayed if the value is invalid.

Parameters

value - System.Web.Mvc.MvcHtmlString

The value that configures the titletemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.TitleTemplateView(Html.Partial("TitleTemplateView")));
                                    });
                                });
                        })
            )

TitleTemplateHandler(System.String)

Defines the hint title that will be displayed if the value is invalid.

Parameters

value - System.String

The value that configures the titletemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.TitleTemplateHandler("titleTemplateHandler"));
                                    });
                                });
                        })
            )

TitleTemplate(Kendo.Mvc.UI.TemplateBuilder)

Defines the hint title that will be displayed if the value is invalid.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the titletemplate.

Example


             @( Html.Kendo().Spreadsheet()
                        .Name("spreadsheet")
                        .Sheets(sheets =>
                        {
                            sheets.Add()
                                .Name("Food Order")
                                .Rows(rows =>
                                {
                                    rows.Add()
                                    .Cells(cells =>
                                    {
                                        cells.Add()
                                            .Value("John Doe")
                                            .Validation(validation => validation.TitleTemplate(Html.Kendo().Template().AddHtml("<b>Full Name</b>")));
                                    });
                                });
                        })
            )

In this article
Not finding the help you need?