How does Ext.Net 7 support Asp.Net Core MVC development model

  1. #1

    How does Ext.Net 7 support Asp.Net Core MVC development model

    It looks like Ext.Net 7 is missing some features,such as:

    1. Use X.AddScript to write Javascript code to client.

    namespace Ext.Net.MVC.Examples.Areas.Form_TextField.InputMask_Native.Controllers
    {
        public class InputMask_NativeController : Controller
        {
            public ActionResult Index()
            {
                return View();
            }
    
            public ActionResult HandleBtnClick()
            {
                var pattern = "99/99/9999";
    
                // Getting the TextField dynamically does not mean its input mask will not be null,
                // so the only way here is to call the actual client-side scripts.
                X.AddScript("App.TextField1.setNote('" + pattern + "');");
                X.AddScript("App.TextField1.inputMask.setPattern('" + pattern + "');");
    
                return new DirectResult();
            }
        }
    }
    2. Use this.GetCmp<>() to get a proxy of client component, and invoke the method of proxy to generate client calls.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace Ext.Net.MVC.Examples.Areas.GridPanel_ComponentColumn.Overview.Controllers
    {
        public class OverviewController : Controller
        {
            public ActionResult Index()
            {
                return View(TestData.GetData());
            }
    
            public ActionResult DoTasks(string tasks)
            {
                var tasksDict = JSON.Deserialize<Dictionary<string, string>[]>(tasks);
                var store = this.GetCmp<Store>("StoreTasks");
    
                foreach (var task in tasksDict)
                {
                    var id = JSON.Deserialize<int>(task["TaskID"]);
                    var progress = JSON.Deserialize<float>(task["Progress"]);
                    var status = JSON.Deserialize<int>(task["Status"]);
    
                    var record = store.GetById(id);
                    record.BeginEdit();
    
                    if (status == 1)
                    {
                        record.Set("Status", 2);
                    }
    
                    progress += 0.2f;
    
                    record.Set("Progress", progress);
    
                    if (progress >= 1)
                    {
                        record.Set("Status", 3);
                    }
    
                    record.EndEdit();
                }
    
                return this.Direct();
            }
        }
    }
    It would be useful to have an article about the MVC development model.
  2. #2
    Hello @Aiken, and welcome to Ext.NET forums, and thanks for your interest and feedback about Ext.NET for ASP.NET Core!

    Your affirmations are right, there are still missing bits and pieces we will definitively implement for the final version of Ext.NET Core.

    I see by your message you are specially concerned with direct events, so you may also be interested in following our public GitHub issue #1713 about DirectEvent support.

    There you'll see a possible approach for attaining the second point of your suggestion. Currently Ext.NET Core is not "posting back" everything in the page each direct event, so you'd need to pass the component the way it is suggested here. Then you'll be able to interact with it.

    Nothing is written in stone, but it is likely many of the approaches we followed in Ext.NET 5 and back will not make it to Ext.NET Core unless they are really useful. It may be that we implement the this.GetCmp<ComponentType>() but at this point we can't ascertain of that, maybe there's just a better way to pass and access components around.

    You are more than welcome to open issues in GitHub (or post threads here) for features you are missing, and they will be seriously considered for the upcoming release. For that bit (X.AddScript and this.GetCmp()), maybe we should wait a little more until issue #1713 above is marked as done before we open specific feature issues for them. I'll point the issue to this thread with the two suggestions you made.

    Thanks again for your feedback, and keep them coming, we really appreciate it!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    I have noticed that Ext.Net 7 support direct event for razorpage development model, but I don't know if I can send direct event to controller action and got a DirectActionResult.
    Last edited by Aiken; Apr 09, 2020 at 2:51 PM.
  4. #4
    Hello @Aiken!

    I understand you may be missing it as this is really not there yet. As one of the mandatory items to assume Direct Events is implemented in Ext.NET 7, is having means for it to work from MVC the way you described (as it works in current, Ext.NET 5). The final product should not change much in regard to MVC concept, so if you have a github account, follow that issue and you'll be notified when we fully implement the Direct Methods and Events to Ext.NET 7.

    The point you raised is relevant and currently we don't have a specific setting for the MVC model, like OnEvent or DirectEvents.<Event>.Url.Action(string), or OnDirectClickUrl=string as we do in Ext.NET MVC.

    And in case the implementation that makes it to Ext.NET 7 is not the same as the previous versions, we will have it documented in some kind of upgrade guide we are also working with, based on what we have in Examples Explorer.

    Again, many things may change from this point, and the feedback from the community (like yours) should weigh a lot on what may or may not become different, be or not be included at all.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Your replies is very helpful, thank you!

Similar Threads

  1. [CLOSED] .Net Core support
    By amitpareek in forum 4.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 09, 2020, 6:21 AM
  2. [CLOSED] Support .Net Core
    By Adans in forum 4.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 09, 2020, 6:11 AM
  3. Replies: 14
    Last Post: Nov 18, 2013, 4:14 PM
  4. Replies: 4
    Last Post: Jun 10, 2011, 9:02 AM
  5. [CLOSED] EXT.NET and ASP.NET MVC View Model
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 18, 2011, 6:04 PM

Tags for this Thread

Posting Permissions