MVC Is it possible to template Lambda Expressions with Moustache or Handlebars?

AndyRow123

I have a template builder that creates section and question sets from a template and then saves to a DB. I am having problems explicitly linking the view to the model as the section and question numbers are dynamic and there are no set amounts:

<div class="form-group">
        @Html.LabelFor(model => model.S{{section}}Name, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.S{{section}}Name)
            @Html.ValidationMessageFor(model => model.S{{section}}Name)
        </div>
</div>

Without the use of the template the above would look like this:

<div class="form-group">
        @Html.LabelFor(model => model.S1Name, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.S1Name)
            @Html.ValidationMessageFor(model => model.S1Name)
        </div>
    </div>

I am trying to dynamically assign these using the templates required method

{{}}

This is not liked by MVC when used like this. I have had no other problems inserting data anywhere else on the same page. Is there a way around this?

Any ideas or help would be appreciated.

Brian Mains

You can't design the template the way you want using the expressions. I'd recommend using the array approach that MVC more inherently uses for something like this, where each item is an array in the model, rather than having the number in the model property name.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

MVC Is it possible to template Lambda Expressions with Moustache or Handlebars?

From Dev

Is it possible to overload lambda expressions?

From Dev

Is it possible to overload lambda expressions?

From Dev

Is it possible to style different sections of handlebars.js/moustache.js templates?

From Dev

Is (or will be) the use of familiar template syntax in lambda expressions allowed?

From Dev

Is it possible to use JavaScript inside handlebars.js template

From Dev

Is it possible to access the data that is sent to handlebars through JS inside the template?

From Dev

Why is it possible to use Lambda Expressions in Thread class?

From Dev

Is that possible to implement a stack with lambda expressions only?

From Dev

Is that possible to implement a stack with lambda expressions only?

From Dev

Handlebars - Decompile handlebars compiled code to handlebars template

From Dev

Is it possible to return a variadic lambda from a function template?

From Dev

Is it possible to return a variadic lambda from a function template?

From Dev

Spring MVC with Moustache sending a string variable.

From Dev

.Net MVC get Lambda expression in Editor Template

From Dev

.Net MVC get Lambda expression in Editor Template

From Dev

Lambda expressions as class template parameters in C++14

From Dev

Capturing a handlebars template as a string

From Dev

HandleBars - template inside templates

From Dev

Handlebars template not iterating correctly

From Dev

Handlebars template - "tilde" in if statement

From Dev

Handlebars Template is not rendered

From Dev

Template not work with Backbone and Handlebars

From Dev

Handlebars template not filling in context

From Dev

Stop rendering template in Handlebars

From Dev

Handlebars template with subexpresion

From Dev

Is possible to convert linq lambda expressions to SQL using dart?

From Dev

Is it possible to convert a string to an int[] using only lambda expressions?

From Dev

Is possible to convert linq lambda expressions to SQL using dart?

Related Related

  1. 1

    MVC Is it possible to template Lambda Expressions with Moustache or Handlebars?

  2. 2

    Is it possible to overload lambda expressions?

  3. 3

    Is it possible to overload lambda expressions?

  4. 4

    Is it possible to style different sections of handlebars.js/moustache.js templates?

  5. 5

    Is (or will be) the use of familiar template syntax in lambda expressions allowed?

  6. 6

    Is it possible to use JavaScript inside handlebars.js template

  7. 7

    Is it possible to access the data that is sent to handlebars through JS inside the template?

  8. 8

    Why is it possible to use Lambda Expressions in Thread class?

  9. 9

    Is that possible to implement a stack with lambda expressions only?

  10. 10

    Is that possible to implement a stack with lambda expressions only?

  11. 11

    Handlebars - Decompile handlebars compiled code to handlebars template

  12. 12

    Is it possible to return a variadic lambda from a function template?

  13. 13

    Is it possible to return a variadic lambda from a function template?

  14. 14

    Spring MVC with Moustache sending a string variable.

  15. 15

    .Net MVC get Lambda expression in Editor Template

  16. 16

    .Net MVC get Lambda expression in Editor Template

  17. 17

    Lambda expressions as class template parameters in C++14

  18. 18

    Capturing a handlebars template as a string

  19. 19

    HandleBars - template inside templates

  20. 20

    Handlebars template not iterating correctly

  21. 21

    Handlebars template - "tilde" in if statement

  22. 22

    Handlebars Template is not rendered

  23. 23

    Template not work with Backbone and Handlebars

  24. 24

    Handlebars template not filling in context

  25. 25

    Stop rendering template in Handlebars

  26. 26

    Handlebars template with subexpresion

  27. 27

    Is possible to convert linq lambda expressions to SQL using dart?

  28. 28

    Is it possible to convert a string to an int[] using only lambda expressions?

  29. 29

    Is possible to convert linq lambda expressions to SQL using dart?

HotTag

Archive