Problem when using ViewBag in EditorTemplate

2 posts, 0 answers
  1. Michel
    Michel avatar
    14 posts
    Member since:
    Sep 2011

    Posted 20 Jul Link to this post

    The View is rendered empty as if there is an exception when Editor is generated.
    The DropDownList is not populated in the Editor.
    If the Bind is commented in the Editor, the view is rendered and the Editor display the dropdownlist of course with no content.
    So The problem comes from the Bind.
    Any Help will be appreciated

    My Model
      public partial class TA_SITE_SIT
        public TA_SITE_SIT()
          TA_BUILDING_BUI = new HashSet<TA_BUILDING_BUI>();
         public Guid GUID_SIT { get; set; }
        public string NAME_SIT { get; set; }
        public virtual ICollection<TA_BUILDING_BUI> TA_BUILDING_BUI { get; set; }
      public partial class TA_BUILDING_BUI
        public Guid GUID_BUI { get; set; }
        public Guid? GUID_SIT { get; set; }
        public string NAME_BUI { get; set; }
        public virtual TA_SITE_SIT GUID_SITNavigation { get; set; }

    My Controller
        public async Task<IActionResult> Index()
          ViewData["arSites"] = new SelectList(_context.TA_SITE_SIT, "GUID_SIT", "NAME_SIT");
          return View(await _context.TA_BUILDING_BUI.ToListAsync());

    My View
        .Columns(columns =>
            columns.Bound(model => model.NAME_BUI);
            columns.Command(command =>
        .Editable(editable =>
        .DataSource(dataSource => dataSource
        .Model(model => model.Id(m => m.GUID_BUI))
        .Update(update => update.Action("Update", "Building"))
        .Destroy(destroy => destroy.Action("Destroy", "Building"))
    My Editor Template
    @model TelAcces3.Models.TA_BUILDING_BUI

  2. Viktor Tachev
    Viktor Tachev avatar
    1438 posts

    Posted 22 Jul Link to this post

    Hello Michel,

    Please make sure that you follow the approach described in the following thread when implementing editor templates.

    Viktor Tachev
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top