This is a migrated thread and some comments may be shown as answers.

who can give me a example of using telrikedior in grid as templator?

1 Answer 13 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
zhang
Top achievements
Rank 1
zhang asked on 29 Dec 2011, 03:24 AM
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? 

1 Answer, 1 is accepted

Sort by
0
zhang
Top achievements
Rank 1
answered on 29 Dec 2011, 03:57 AM
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.cre
at 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.
 
Tags
Grid
Asked by
zhang
Top achievements
Rank 1
Answers by
zhang
Top achievements
Rank 1
Share this question
or