This is a migrated thread and some comments may be shown as answers.
customizing popup editor
4 Answers 278 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ymris
Top achievements
Rank 1
Ymris asked on 17 Sep 2010, 10:51 PM
Is there any way customizing the editor apart from just hiding columns or tricking it like discribed here?
Reordering the properties would be a good start.
Looks like they appear in the order they are defined in the type.

Regards,
Micha

4 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 18 Sep 2010, 07:21 PM
Hello Michael Sander,

The grid is using ASP.NET MVC editor templates. I suggest you check this blog post by Brad Wilson which explains in editor template customization.

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
Ymris
Top achievements
Rank 1
answered on 19 Sep 2010, 12:35 PM
Really good hint, somehow I thought those templates only work for properties, thanks a lot!
0
Matthew
Top achievements
Rank 1
answered on 20 May 2011, 04:26 AM
Atanas,

I followed the blog post code example to create a custom edit template for my MVC Grid Editor (in a popup).  I have three fields that have templates specified using UIHint in the model definitions.  The templates for the UIHints specify the fields to be Telerik dropdownlists.  These work as when I set my MVC grid to edit inline the cells show the dropdownlists appropriately.  When I set the TemplateName method on my editable grid to my custom edit template the three dropdownlist fields display the ids stored in them instead of a dropdownlist.

Here is my custom edit template which is a direct copy of Brad Wilson's example.  Does this template do something different then the standard edit template used by MVC?  It doesn't seem to want to render for my dropdownlist templated fields.

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<% if (ViewData.TemplateInfo.TemplateDepth > 1)
   { %>
<%= ViewData.ModelMetadata.SimpleDisplayText %>
<% }
   else
   { %>
<table cellpadding="0" cellspacing="0" border="0">
    <% foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !ViewData.TemplateInfo.Visited(pm)))
       { %>
    <% if (prop.HideSurroundingHtml)
       { %>
    <%= Html.Editor(prop.PropertyName) %>
    <% }
       else
       { %>
    <tr>
        <td>
            <div class="editor-label" style="text-align: right;">
                <%= prop.IsRequired ? "*" : "" %>
                <%= Html.Label(prop.PropertyName) %>
            </div>
        </td>
        <td>
            <div class="editor-field">
                <%= Html.Editor(prop.PropertyName) %>
                <%= Html.ValidationMessage(prop.PropertyName, "*") %>
            </div>
        </td>
    </tr>
    <% } %>
    <% } %>
</table>
<% } %>

Are there any examples or something else I should be aware of?

I've attached a screen capture of what the fields look like in the popup editor.

Thanks in advance for any input.
0
Atanas Korchev
Telerik team
answered on 20 May 2011, 07:19 AM
Hi Matthew,

 This happens because of a limitation in ASP.NET MVC which I have also blogged about. The blog post explains the problem and the solution.

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
Tags
Grid
Asked by
Ymris
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Ymris
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Share this question
or