[Solved] Taghelpers Vs Html Helper Validation for Kendo Default template projects

1 Answer 301 Views
Grid
Rajesh
Top achievements
Rank 1
Iron
Rajesh asked on 02 Aug 2023, 03:32 PM

Hello i was just curious if there is any difference between html validation vs tag helper validation.? I am using the basic template that kendo provides to create a new project and i have observed the differences that by default html helper project provides validation but tags option doesn't create validation .Am i missing anything?

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Mihaela
Telerik team
answered on 03 Aug 2023, 08:26 AM

Hello Rajesh,

Indeed, your observations are correct, the TagHelper implementation of the ASP.NET Core components is not strongly-typed. The Grid is built depending on the options of the Grid and it does not have access to the Model. For this reason, the DataAnnotations are not available when using TagHelpers.

This is further discussed within the following forum thread:

https://www.telerik.com/forums/taghelpers-behavior-different-than-razor-syntax

If you would like to apply validation to certain columns, then you would have to do so by setting up the <validation> tag. It is part of the schema model declaration of the data source.

        <kendo-grid name="grid" height="550">
           ...
            <datasource type="DataSourceTagHelperType.Ajax" page-size="20">
                <schema data="Data" total="Total">
                    <model id="OrderID">
                        <fields>
                            <field name="OrderID" type="number" editable="false"></field>
                            <field name="ShipName" type="string"></field>
                            <field name="OrderDate" type="date">
                                <validation required="true" />
                            </field>
                            <field name="ShipCity" type="string"></field>
                            <field name="Freight" type="number"></field>
                        </fields>
                    </model>
                </schema>
                ...
            </datasource>
        </kendo-grid>

If you want to implement a custom validation rule like the field should start with a capital letter or change the messages, there is a need to extend the validator as shown in the script in this demo source:

 

Let me know in case additional clarifications are needed.

Regards, Mihaela Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Muhammad
Top achievements
Rank 1
commented on 03 Aug 2026, 12:13 PM

Despite include  <validation required="true" /> the validation span is not getting created thus validation never works as documented.

Unfortunatily, Documentaiton is quite outdated.

Very disapointing.
Rumen
Telerik team
commented on 05 Aug 2026, 08:32 AM

Thanks for flagging this. To clarify: the <validation required="true" /> tag configures the schema.model.fields validation rules used by the Kendo Validator when the Grid enters edit mode (inline/incell/popup) and it does not produce ASP.NET Core's built-in unobtrusive validation spans, since the Grid TagHelpers aren't strongly-typed against your model (as noted earlier in this thread).

If the validation message truly isn't appearing during actual editing (not just on initial page load, where no validation runs yet), could you share a minimal repro, ideally a REPL sample or your Grid TagHelper markup plus the editing mode you're using (inline/incell/popup)? That will let us confirm whether the <validation> settings are being serialized correctly to the client, or if there's an issue specific to your editor template/field type. Thank you!
Tags
Grid
Asked by
Rajesh
Top achievements
Rank 1
Iron
Answers by
Mihaela
Telerik team
Share this question
or