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

[Solved] Using the editor in an MVC 2 page

8 Answers 186 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.
JAS J
Top achievements
Rank 1
JAS J asked on 26 Aug 2010, 10:42 PM
I have a minimal edit page and I want to use the telerik editor to edit so a field. My view page looks like this:

 

 

 

 

<body>
    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        <fieldset>
            <legend>Fields</legend>
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Name) %>
            </div>
  
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Name) %>
                <%: Html.ValidationMessageFor(model => model.Name) %>
            </div>
              
            <div class="editor-label">
                <%: Html.LabelFor(model => model.Data) %>
            </div>
            <div class="editor-field">
                <%:
                    Html.Telerik().Editor()
                    .Name("Editor")
                    .Value(model => model.Data)
                    %>
                <%: Html.ValidationMessageFor(model => model.Data) %>
            </div>
            <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>
    <% } %>
  
    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>
    <%= Html.Telerik().ScriptRegistrar() %>
</body>

I have the script registrar at the bottopm of the page. When I run this, I get an error:

Compiler Error Message: CS1501: No overload for method 'Editor' takes 0 arguments

Source Error:

Line 34:              <div class="editor-field">
Line 35:                 <%:
Line 36: Html.Telerik().Editor()Line 37:                     .Name("Editor")
Line 38:                     .Value(model => model.Data)


Any Idea what the problem might be?
thanks
Jas
.

 

 

 

 

 

 

8 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Aug 2010, 07:43 AM
Hello JAS J,

This is very strange as we are using very similar setup in our online demo. Could you please provide a sample project reproducing this problem?

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
JAS J
Top achievements
Rank 1
answered on 27 Aug 2010, 01:03 PM
Hi Atanas,

Thanks for the response. The easiest way for me to to repro this is to do the following:
1. Using VS 2010, create a MVC2 web project (not empty)
2. Add the reference to the Telerik DLL. I am using the one from
     \Telerik\Extensions for ASP.NET MVC Q1 2010\Content\2010.1.518
3. Add all the scripts from \Telerik\Extensions for ASP.NET MVC Q1 2010\Scripts\2010.1.518
4. Add the CSS files from \Telerik\Extensions for ASP.NET MVC Q1 2010\Content
5. Edit the site.master to add <%= Html.Telerik().ScriptRegistrar() %> right before the </Body> tag
6. In the Site.Master itself, add the Editor - above the scriptregistrar statement:

    <%  Html.Telerik().

 

Editor() .Name("Editor") .Value(" hello ");%>

When I run the sample I get
Compiler Error Message: CS1501: No overload for method 'Editor' takes 0 arguments

Source Error:

Line 39:     </div>
Line 40:     <%
Line 41: Html.Telerik().Editor()Line 42:                         .Name("Editor")
Line 43:                         .Value("  hello  ");

Source File: c:\Users\Jude\Documents\Dev\LMS2\LMS2\Views\Shared\Site.Master    Line: 41

 

0
Atanas Korchev
Telerik team
answered on 27 Aug 2010, 01:13 PM
Hello JAS J,

You are using an old version (2010.1.518). The editor was introduced later (2010.2.825).

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
JK
Top achievements
Rank 1
answered on 27 Aug 2010, 01:58 PM

Thanks! now it shows up... but the tool bar is missing and all I see is the text version of the tool bar - as below.



  • bold
  • italic
  • underline
  • strikethrough
  • select
  • select


    thanks!

  • 0
    Atanas Korchev
    Telerik team
    answered on 27 Aug 2010, 03:55 PM
    Hi JK,

    This indicates that the theme CSS file has failed to load or not loaded at all.

    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
    JK
    Top achievements
    Rank 1
    answered on 27 Aug 2010, 07:50 PM
    What is the best way to debug that?
    My content directory has a telerik.default.min.css and a default sub folder with editor.png in it

    Do I need to add anything in my site.master other than the
    <%= Html.Telerik().ScriptRegistrar() %>

    ?

    Also the aspx that I am editing has only the

    <%

     

    : Html.Telerik().EditorFor(model => model.Data).Name("Editor")%>

    Do I need any other statements to load the css?

     



    thianks
    JK
    0
    Peter
    Top achievements
    Rank 1
    answered on 29 Aug 2010, 08:57 AM
    Hi,
    I suppose that you forgot to add StyleSheetRegistrar(), which renders css files. Check this help topic.

    Regards,
    Peter
    0
    JK
    Top achievements
    Rank 1
    answered on 29 Aug 2010, 03:04 PM
    Thanks! that worked!
    Tags
    Editor
    Asked by
    JAS J
    Top achievements
    Rank 1
    Answers by
    Atanas Korchev
    Telerik team
    JAS J
    Top achievements
    Rank 1
    JK
    Top achievements
    Rank 1
    Peter
    Top achievements
    Rank 1
    Share this question
    or