Migrating from EXT.Net 4.7 to 7.2 Classic (for Core) - Syntax question

  1. #1

    Migrating from EXT.Net 4.7 to 7.2 Classic (for Core) - Syntax question

    Hi, my team is migrating from EXT.Net 4.7 (.Net Framework) into EXT.NET 7.2 Classic for Core. We have been using the MVC/Razor syntax for views for years and hoped we would find the same syntax available here. Is that something that still exists? Knowing that 7.2 is still very new, I haven't found any similar questions.

    Thanks so much!

    Example of what I'm looking for

    @{
        ViewBag.Title = "Default Button - Ext.NET MVC Examples";
        Layout = "~/Views/Shared/_BaseLayout.cshtml";
        var X = Html.X();
    }
    
    @section example
    {
        @(X.Container()
            .Layout(LayoutType.VBox)
            .Height(650)
            .Items(
                X.FormPanel()
                    .Title("Last Button by default")
                    .BodyPadding(5)
                    .Width(350)
                    .Items(
                        X.TextField()
                            .FieldLabel("Item 1"),
                        X.TextField()
                            .FieldLabel("Item 2")
                    )
                    .Buttons(
                        X.Button().
                            Text("Button 1"),
                        X.Button()
                            .Text("Button 2")
                            .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');")
                    ),
    
                X.FormPanel()
                    .Title("Button by Index")
                    .DefaultButton("1")
                    .BodyPadding(5)
                    .Width(350)
                    .Items(
                        X.TextField()
                            .FieldLabel("Item 1"),
                        X.TextField()
                            .FieldLabel("Item 2")
                    )
                    .Buttons(
                        X.Button().
                            Text("Button 1"),
                        X.Button()
                            .Text("Button 2")
                            .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');"),
                        X.Button().
                            Text("Button 3"),
                        X.Button().
                            Text("Button 4")
                    ),
    
                X.FormPanel()
                    .Title("Button by ID")
                    .DefaultButton("Button2")
                    .BodyPadding(5)
                    .Width(350)
                    .Items(
                        X.TextField()
                            .FieldLabel("Item 1"),
                        X.TextField()
                            .FieldLabel("Item 2")
                    )
                    .Buttons(
                        X.Button().
                            Text("Button 1"),
                        X.Button()
                            .Text("Button 2")
                            .ID("Button2")
                            .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');"),
                        X.Button().
                            Text("Button 3"),
                        X.Button().
                            Text("Button 4")
                    ),
    
                X.FormPanel()
                    .Title("Button by Selector")
                    .DefaultButton("button[text=Button 2]")
                    .BodyPadding(5)
                    .Width(350)
                    .Items(
                        X.TextField()
                            .FieldLabel("Item 1"),
                        X.TextField()
                            .FieldLabel("Item 2")
                    )
                    .Buttons(
                        X.Button().
                            Text("Button 1"),
                        X.Button()
                            .Text("Button 2")
                            .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');"),
                        X.Button().
                            Text("Button 3"),
                        X.Button().
                            Text("Button 4")
                    )
            )
        )
    }
    Last edited by craigthames; Dec 03, 2020 at 4:51 PM.
  2. #2
    Hi. I was able to run the sample you provided [basically] unchanged in Ext.NET Classic v7.2.0 on .NET 5.0.

    Here's the diff, https://www.diffchecker.com/J1i1wz8k

    The only diff I ran into was .ID("Button2") needed to be revised to .Id("Button2"). I'll create an issue for that and we will discuss adding a .ID() HtmlHelper to help with backwards compatibility. Although, I also don't see performing a search-and-replace for .ID( to .Id( that big of deal either.

    Hope this helps.
  3. #3
    That wasn't what I was having trouble with. It was actually the code that was needed in _ViewImports.cshtml that I was missing. If anyone else runs into this question, this link should help:

    https://docs.ext.net/guides/getting_started/
  4. #4
    Thanks for the update.

    Just as a quick follow-up for anyone reading this thread in the future, installing the Ext.NET Templates and running the dotnet new extnet-mvc command will quickly setup Ext.NET Classic into a new MVC project.

    Same thing if you install the Visual Studio Extensions. and then File > New > Project... and select the Ext.NET MVC Web App project type.

    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. Ext.Net.Classic Example not working
    By mtsig in forum 7.x Classic Premium Help
    Replies: 6
    Last Post: Oct 15, 2020, 5:00 PM
  2. Ext.NET 7.0 Classic for ASP.NET Core Now Available
    By geoffrey.mcgill in forum 7.x Classic Premium Help
    Replies: 0
    Last Post: Oct 08, 2020, 4:37 PM
  3. Ext.NET 7.0 Classic for ASP.NET Core Now Available
    By geoffrey.mcgill in forum Open Discussions
    Replies: 0
    Last Post: Oct 08, 2020, 4:36 PM
  4. Icons summary Ext.Net 7.0 Classic
    By lu7jm in forum 7.x Classic Help
    Replies: 1
    Last Post: Jun 20, 2020, 1:53 AM
  5. Replies: 4
    Last Post: Apr 10, 2020, 1:42 AM

Posting Permissions