Oct 15, 2020, 10:43 AM
Ext.Net.Classic Example not working
Hello,
i am trying to run a simple example of ext.net.classic but i have the following error:
JavaScript critical error at line 1882, column 21 in http://localhost:5000/extnet/extnet/...n\nSCRIPT1028: Expected identifier, string or number
I have visual studio 2019 Pro and and Ext.net.Classic 7.0.0
I am doing someτhing wrong ?
Startup Code
i am trying to run a simple example of ext.net.classic but i have the following error:
JavaScript critical error at line 1882, column 21 in http://localhost:5000/extnet/extnet/...n\nSCRIPT1028: Expected identifier, string or number
I have visual studio 2019 Pro and and Ext.net.Classic 7.0.0
I am doing someτhing wrong ?
Startup Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO.Compression;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Ext.Net;
using Ext.Net.Core;
using Westwind.AspNetCore.LiveReload;
namespace WebApplication1
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<GzipCompressionProviderOptions>(options =>
{
options.Level = System.IO.Compression.CompressionLevel.Optimal;
});
services.AddResponseCompression(options =>
{
options.EnableForHttps = false;
options.Providers.Add<GzipCompressionProvider>();
options.MimeTypes = new[]
{
"text/css",
"application/javascript",
"application/json",
"text/json",
"application/xml",
"text/xml",
"text/plain",
"image/svg+xml",
"application/x-font-ttf"
};
});
#if DEBUG
services.AddRazorPages().AddRazorRuntimeCompilation();
// See https://github.com/RickStrahl/Westwind.AspnetCore.LiveReload
services.AddLiveReload();
#endif
// 1. Register Ext.NET services
services.AddExtNet();
services.AddExtCharts();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseLiveReload();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseResponseCompression();
// 2. Use Ext.NET resources
// To be added prior to app.UseStaticFiles()
app.UseExtNetResources(config =>
{
#if DEBUG
config.UseDebug(true);
#endif
config.UseEmbedded();
config.UseCharts();
config.UseThemeSpotless();
});
// 3. Enable Ext.NET localization [not required]
// If included, localization will be handled automatically
// based on client browser preferences
app.UseExtNetLocalization();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
// 4. Ext.NET middleware
// To be added prior to app.UseEndpoints()
app.UseExtNet(config =>
{
config.Theme = ThemeKind.Spotless;
});
app.UseEndpoints(endpoints => endpoints.MapRazorPages());
}
}
}
index.cshtml.csusing Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Ext.Net;
using Ext.Net.Core;
namespace Company.WebApplication1.Pages
{
[DirectModel]
public class IndexModel : PageModel
{
public void OnGet()
{
}
[Direct]
public IActionResult OnPostButtonClick()
{
this.X().Toast("Button Clicked ðŸ‘");
return this.Direct();
}
}
}
index.cshtml@page "{handler?}"
@model Company.WebApplication1.Pages.IndexModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ext.NET web application</title>
</head>
<body style="padding: 30px;">
<ext-panel
title="Sample Panel"
iconCls="x-md md-icon-check-circle-outline"
width="480"
height="360"
layout="Fit"
bodyPadding="18"
collapsible="true"
html="Click button to call server-side [Direct] handler">
<buttons>
<ext-button
text="Click Me"
scale="Medium"
iconCls="x-md md-icon-chat-bubble-outline">
<directevents>
<click pageHandler="ButtonClick" method="POST" />
</directevents>
</ext-button>
</buttons>
</ext-panel>
</body>
</html>