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

[Solved] Kendo Razor Grid Textbox Validation

1 Answer 255 Views
Grid
This is a migrated thread and some comments may be shown as answers.
crazy05
Top achievements
Rank 1
crazy05 asked on 12 Mar 2015, 02:08 PM
Below is my Grid, I am trying to add zip codes to the grid. When I click on Add New Zip Code, I am getting textbox inline. I want to validate that zip Code. User can enter 55555 or 55555-1111. How can I do this ?
 
@(Html.Kendo().Grid(Model)
.Name("ZipGrid")
.HtmlAttributes(new { @class = "GridStyle" })
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden();
columns.Bound(p => p.ZipCode).Width(250);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.ToolBar(toolBar =>
{
toolBar.Create().Text("Add Zip Code");
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("onError"))
.Model(model => model.Id(p => p.Id))
.Create(create => create.Action("AddZipCode", "Manage"))
.Read(read => read.Action("GetZipCode", "Manage"))
.Update(update => update.Action("UpdateZipCode", "Manage"))
.Destroy(Destroy => Destroy.Action("AddZipCode", "Manage")).ServerOperation(false)
)
)

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 16 Mar 2015, 09:08 AM

Hello Ram,

 

The following example demonstrates how you could implement custom validation rules - http://demos.telerik.com/aspnet-mvc/grid/editing-custom-validation

 

You can use the same approach for your requirement.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
crazy05
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or