How to install Ext.NET 2.0 in VS2012 MVC4 Project?

I have big doubts that my question will be answered, but I will try here, since the levels of disappointment are so high that, perhaps, this will help me omit them!

So, I want to do the following:

  • Install VS2012 from scratch (okey, click .exe and go!)
  • Create a new MVC4 project
  • Use the Razor View Engine (it is currently the default)
  • MAKE EXT.NET 2.0 WORK FROM ABOVE

This will be a feature of Ext.NET 2.1 , since all requirements will be packaged in the nuGet package, the only problem is that I, as the other few developers would like to use those things that already work now

What i did now:

  • After this thread, I installed web.config correctly!
  • Make VS2012 recognize Ext.Net link

Here's how:

  • Create a new project, select the Basic / Empty / Internet Application templates
  • In the resources of your project add a link to Ext.NET.dll (view, search, etc.).
  • Edit web.config this way:

http://diffchecker.com/v99ScX0x

  • Edit views /web.config as follows:

http://diffchecker.com/7UEK058Y

Hope the diffchecker is clear enough for you to understand, in any case, changes to SAME in both files, they should be like that!

  • Add the following line to App_Start / RouteConfig.cs

routes.IgnoreRoute ("{exclude} / {extnet} /ext.axd");

  • Now I continue to follow the thread in which I am linked above
  • Create a managed one with the name "Examples" โ†’ ExamplesController.cs, no changes are required here.
  • Create a view above the controller. So, Views / Examples / Index.cshtml

There, I edited this page a bit to make it more similar to the MVC style, in fact it doesnโ€™t matter. Whole page:

@{ ViewBag.Title = "Infinite Scrolling - Ext.NET Examples"; } @Html.X().ResourceManager() <h1>Infinite Scrolling</h1> <p>The brand new GridPanel supports infinite scrolling, which enables you to load any number of records into a grid without paging.</p> <p>The GridPanel uses a new virtualized scrolling system to handle potentially infinite data sets without any impact on client side performance.</p> <br /> @(Html.X().GridPanel() .Title("Stock Price") .Height(500) .Width(500) .InvalidateScrollerOnRefresh(false) .DisableSelection(true) .Store(store => store.Add(Html.X().Store() .PageSize(100) .Buffered(true) .AutoLoad(false) .Proxy(proxy => proxy.Add(Html.X().AjaxProxy() .Url("/Data/GetData/") .Reader(reader => reader.Add(Html.X().JsonReader() .Root("data") )) )) .Model(model => model.Add(Html.X().Model() .Fields(fields => { fields.Add(Html.X().ModelField().Name("Company")); fields.Add(Html.X().ModelField().Name("Price")); fields.Add(Html.X().ModelField().Name("LastUpdate").Type(ModelFieldType.Date)); }) )) )) .VerticalScroller(scroller => scroller.Add(Html.X().GridPagingScroller())) .ColumnModel(columnModel => { columnModel.Columns.Add(Html.X().RowNumbererColumn().Width(50).Sortable(false)); columnModel.Columns.Add(Html.X().Column() .Text("Company") .DataIndex("Company") .Flex(1)); columnModel.Columns.Add(Html.X().Column() .Text("Price") .DataIndex("Price") .Width(70)); columnModel.Columns.Add(Html.X().DateColumn() .Text("LastUpdate") .DataIndex("LastUpdate") .Width(140) .Format("HH:mm:ss")); }) .View(view => view.Add(Html.X().GridView().TrackOver(false))) .Listeners(listeners => { listeners.AfterRender.Handler = "this.store.guaranteeRange(0, 99);"; listeners.AfterRender.Delay = 100; }) ) 
  • Then I added another controller to make it work, EXACTLY, as the thread says
  • Add DataController.cs as here CONFIRMATION AjaxStoreResult With StoreResult
  • DataController.cs also needs

    using Ext.Net.MVC;

So here I am!
If you run your IIS Express, you can run the page in localhost: XXXXX / Examples /

The first problem I have: the page is trying to load localhost: XXXX / extjs / libraries, which is NOT MVC-STYLE!

This is done using @ Html.X (). ResourceManager (), is there a way to make this connection to cdn libraries ? or even change the way! ??

Other problems are likely to arise after this, but now I would like to solve this small painful problem.

+4
source share
1 answer

Based on the Web.config files you referenced above, I think you are missing the <modules> and <handlers> in Web.config. The required sections of Web.config are listed in the README.txt file.

http://examples.ext.net/#/Getting_Started/Introduction/README/

Here is the corresponding <system.webServer> section from the Web.config example.

Example

 <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net" /> </modules> <handlers> <add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler" /> </handlers> </system.webServer> 

I don't know what โ€œNOT MVC-STYLEโ€ means in the following quote. Can you give more explanation?

The first problem I have: the page is trying to load localhost: XXXX / extjs / libraries, which is NOT MVC-STYLE!

You can prevent the Ext.NET ResourceManager from displaying the required .js and .css files by setting .RenderScripts(ResourceLocationType.None) and .RenderStyles(ResourceLocationType.None) .

Example

 @Html.X().ResourceManager() .RenderScripts(ResourceLocationType.None) .RenderStyles(ResourceLocationType.None) 

You can configure the ResourceManager to load CDN files by changing the ResourceLocationType.None attribute to ResourceLocationType.CDN .

Hope this helps.

+8
source

Source: https://habr.com/ru/post/1439401/


All Articles