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

[Solved] Editor doesn't work with prefixes!

3 Answers 106 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sam Critchley
Top achievements
Rank 1
Sam Critchley asked on 26 Aug 2010, 06:44 AM
In my date template i write this:

<%= Html.Telerik().DatePicker().Name(ViewData.TemplateInfo.GetFullHtmlFieldName("")) %>

And that binds just fine.

However with the editor I am doing something similar.

Html.Telerik().Editor().Name(ViewData.TemplateInfo.GetFullHtmlFieldName("")).Tools((p)=>{
        p.Clear();
        p.FormatBlock().Bold().Italic().Underline().Strikethrough().JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().InsertOrderedList().InsertUnorderedList().Indent().Outdent().CreateLink().Unlink().InsertImage();
    }).Value(Convert.ToString(Model)).Render();

And it fails. Here's what comes back to the server:

"AddModel.Subject=test&AddModel.PublishingStatusId=1&AddModel.Date=26%2f08%2f2010&AddModel_Content=ma+content!"

AddModel_Content should be AddModel.Content. Date works as expected. This isn't a beta anymore is it? 

3 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 26 Aug 2010, 08:25 AM
Hi Sam Critchley,

 I was able to reproduce this problem. Fortunately it is easy to fix it:

  1. Open EditorHtmlBuilder.cs from the source code
  2. Locate the CreateTextArea method
  3. Change this
                var content = new HtmlTag("textarea")
                                .Attributes(new
                                {
                                    title = editor.Id,
                                    @class = "t-content t-raw-content",
                                    cols = "20",
                                    rows = "5",
                                    name = editor.Id,
                                    id = editor.Id + "-value"
                                });

    to this
                var content = new HtmlTag("textarea")
                                .Attributes(new
                                {
                                    title = editor.Id,
                                    @class = "t-content t-raw-content",
                                    cols = "20",
                                    rows = "5",
                                    name = editor.Name,
                                    id = editor.Id + "-value"
                                });
  4. Rebuild (make sure the build configuration is set to "Release MVC2 NET35")
  5. Use the Telerik.Web.Mvc.dll assembly in your project.

I have updated your Telerik points.


Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mike
Top achievements
Rank 2
answered on 26 Aug 2010, 06:36 PM
I have noticed that when you use the EditorFor extension like so:
<%= Html.Telerik().EditorFor(m=>m.Details) %>
inside a partial view that is an editor template for an entire type, the name attribute for the Editor is generated like 
"Entity_Details" as apposed to "Entity.Details". My problem with this is, its not consistent behavior with the rest of the built in ASP.NET MVC MS extensions, which causes UpdateModel to not be to persist the value of the field to the model within the controller. 

I would have used 
<%= Html.Telerik().Editor().Name("Entity.Details") %>
as a work around, but the period is replaced with a _ in the name attribute. So at this point, there is no viable option to getting UpdateModel to work for this scenario. 

I would really like to see this fixed in the next release. 

Thanks. 
0
Sam Critchley
Top achievements
Rank 1
answered on 27 Aug 2010, 01:10 AM
Thanks Atanas. Worked like a charm.
Tags
Editor
Asked by
Sam Critchley
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mike
Top achievements
Rank 2
Sam Critchley
Top achievements
Rank 1
Share this question
or