This question is locked. New answers and comments are not allowed.
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