PDA

View Full Version : "asp-for" syntax not valid



Fahd
Apr 03, 2023, 7:29 PM
I have a MVC project. I am just wondering what is Equivalent to "asp-for" so that I can use Model property for value and validations. It doesn't look like a valid syntax.

<ext-textarea asp-for="Age" ></ext-textarea>

fabricio.murta
Apr 04, 2023, 7:13 PM
Hello, @Fahd!

The first thing that comes to mind given your snippet is, model=, that is basically setting up the component from "code behind" (from the model). There's no asp-for in Ext.NET 7, and there were a similar concept in Ext.NET 5- which had several types of components "for" (FormPanel example (https://mvc5.ext.net/#/Models/FormPanelFor/)), which applied basically to MVC models.

The model= concept in Ext.NET 7 is broader (in contrast to Ext.NET 5-'s) as it is not limited to the component's data, but its actual configuration, which I believe will allow much finer-grained control over the component data, looks & validation.

We use the concept in Examples explorers showcasing "code-behind-equivalent" examples to some "markup-driven" ones.

Here's one example using it: Tree Panel > Built in Codebehind (https://examples.ext.net/#/treepanel/basic/built_in_codebehind)

If you search for the codebehind word in Examples Explorer (top-left, there's a "filter" field), several other examples using it are shown. They don't necessarily need all set up from code behind, some configs could be set in markup and other (say, dynamic ones) in code behind/controller to customize the component's behavior.

Hope this helps!