I have a model of article.I make an article list by grid.Now I want to edit the article content
using telerikeditor,I do not know how to define the .EditTemplate.I use Razor.Who can help
to show an example?
ignore the question.I try to solve it by myself.
How can we do this:JUST SEE BELOW:
1.you need a model:
public class article_lists
{
[Key]
public System.Guid id { get; set; }
[UIHint("ArtilcleContent")]
public string ArtilcleContent { get; set; }//artilclecontent can be very long html string;
}
2.you creat a foler in your views folder: named :EditorTemplates
3.creat a strong typed partialview in this foler.named ArtilcleContent.cs
notice:when creat the view ,you must choose strong typed and partialview!
and the name of the view must be ArtilcleContent,as same as the uihint
you used in model: [UIHint("ArtilcleContent")]
4.then we use telerikedior in partialview to creat the templator:
@model article_lists
@{ Html.Telerik().Editor()
.Name("ArtilcleContent") //notice the name must be the right model property name.
.HtmlAttributes(new { style = "height:200px" })
.Encode(false)
.Value(@<text>Model.ArtilcleContent</text>)
.Render();
}
and the end.you can run to see what happend.
I am new to mvc.but i found i like it much and much .It is simple and beautiful if you try to
understand it more and more.