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

[Solved] view dto description on grid and edit it on dropdownllist

1 Answer 109 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.
Marco
Top achievements
Rank 1
Marco asked on 04 Mar 2010, 12:23 PM
Hello, i have a grid where i'm showing a strong type custom object like this way

 columns.Bound(o => o.EmentaUnidade.nome).Title("Unidade(s)");

what i want to do is edit it using a drop down list and use a uint in dto.

i will post the code here so someone could help me accomplishing this task.

my model object (dto)

namespace SIG.DomainModel.Entities 
    [MetadataType(typeof(EmentaMetadata))] 
    public partial class Ementa 
    { 
        
    } 
 
    public class EmentaMetadata 
    { 
 
        [UIHint("refeicoes")] 
        public int idRefeicao { get; set; } 
 
        [DataType(DataType.Date)] 
        public DataType data { get; set; } 
 
        [UIHint("unidades")] 
        public Unidade EmentaUnidade 
        { get; set; } 
    } 

my editor template for unidades

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> 
<%@ Import Namespace="System.Globalization" %> 
<%@ Import Namespace="Microsoft.Practices.ServiceLocation" %> 
<%@ Import Namespace="F5ITWEB.BusinessLogicLayer" %> 
 
<%= Html.DropDownList("", ServiceLocator.Current.GetInstance<ILoggedOnUser>().AvailableUnities 
            .Select(unidade => new SelectListItem  
            { 
                Text = unidade.nome, 
                Selected = unidade.id.Equals(Model), 
                Value = unidade.id.ToString(), 
            }))%> 


what is happening now is that on edit mode i see the expected behavior (the property nome is showed)

but when i pass to edit mode the unidades editor is not displayed.

if i use this editortemplate for the id of the dto what is rendered is the id and on edit mode i see the dropdownlist

someone can help me whit this task?

best regards
Marco

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 04 Mar 2010, 12:43 PM
Hi Marco,

Unfortunately I couldn't understand what the problem is. Double check if the UIHint is properly set (casing etc) also make sure the property names of the original object and the metadata object match.

Without seeing a sample project I won't be able to help much in this case.

All the best,
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
Marco
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or