How do I set the value to a model value in a template?

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    3 posts
    Member since:
    Sep 2014

    Posted 02 Apr 2015 Link to this post

    I have a popup editor template with an editor in it and I'm trying to figure out how to set the value to the model field value. I have :

          .HtmlAttributes(new { style = "width: 590px;height:440px" })

    But that does not work. Anyone know the answer?
  2. Alexander Popov
    Alexander Popov avatar
    1436 posts

    Posted 06 Apr 2015 Link to this post

    Hello Daniel,

    Basically, this happens through an MVVM value binding, which is generated according to the widget's name. I would suggest using a strongly typed View and the EditorFor helper, which assigns a name matching the used field. For example: 
    @model MyModel
          .HtmlAttributes(new { style = "width: 590px;height:440px" })

    Alexander Popov

    See What's Next in App Development. Register for TelerikNEXT.

Back to Top