如何对设置在VS2012 MVC4项目Ext.NET 2.0吗? [英] How-to setup Ext.NET 2.0 in a VS2012 MVC4 Project?

查看:729
本文介绍了如何对设置在VS2012 MVC4项目Ext.NET 2.0吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很高的怀疑,我的问题将得到解答,但我会尽力在这里,因为我的挫折感水平是如此之高,也许这将有助于降低自己他们!

i have high doubts that my question will be answered, but i'll try here since my frustration levels are so high that maybe it will help myself lower them!

所以,我想要做的是:


  • 从从头开始安装VS2012(好,点击.exe和去!)

  • 创建一个新的项目MVC4

  • 使用的Razor视图引擎(这是时下默认)

  • 请EXT.NET 2.0工作要高于

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

<一个href=\"http://forums.ext.net/showthread.php?18956-CLOSED-Will-Installation-via-Nuget-eventually-support-Ext-NET-MVC&p=91797&viewfull=1#post91797\"相对=nofollow>这是要去的Ext.NET 2.1 一个特点,因为所有的要求,将在包的NuGet打包来,唯一的问题就是我的,其他少数开发商想用这些事情的已经做对现在的工作

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

我所succeded现在在做什么:

What i've succeded doing right now:

  • Following this thread i've setup web.config correctly!
  • Make VS2012 to recognize the Ext.Net reference

下面的方式:


  • 创建新的项目,选择基本/空/互联网应用程序的模板

  • 在您的项目资源,添加引用Ext.NET.dll(浏览,查找等)

  • 在这样的方式编辑web.config中:

http://diffchecker.com/v99ScX0x


  • 编辑查看/ web.config中以这样的方式:

http://diffchecker.com/7UEK058Y

我希望diffchecker是非常明显的,让你明白,反正变化是在在这两个文件,​​他们必须这样!

I hope diffchecker is clear enough to let you understand, anyway the changes are the SAME in both files, they have to be so!


  • 添加以下行App_Start / RouteConfig.cs

routes.IgnoreRoute({排除} / {} extnet /ext.axd);

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


  • 现在,我继续下面的线程我已经上述链接

  • 创建控制名为示例 - > ExamplesController.cs,这里不需要修改

  • 创建上述控制器的视图。所以查看/例子/ Index.cshtml

有我所编辑的网页了一下,让它多一点MVC风格的,没什么大真的。
整个页面如下:

There i have edited the page a bit, to make it a bit more MVC-style, it's nothing big really. Entire page follows:

@{
    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; 
    })
)


  • 然后我添加另一个控制器,以使其工作,正是因为线程说

  • 添加DataController.cs为<一个href=\"http://forums.ext.net/showthread.php?16920-CLOSED-2-0-MVC-3-Razor-Example&p=72510&viewfull=1#post72510\"相对=nofollow>这里所指 SUBSTITUING AjaxStoreResult WITH StoreResult

  • DataController.cs还需要

    • Then i've added another controller in order to make it work, EXACTLY as thread says
    • Add DataController.cs as referred here SUBSTITUING AjaxStoreResult WITH StoreResult
    • DataController.cs also needs

      使用Ext.Net.MVC;

      using Ext.Net.MVC;

      所以,我在这里!结果
      如果您启动IIS前preSS现在你可以在本地主机执行页:XXXXX /例子/搜索

      So here am I!
      If you start your IIS Express now you can execute the page in localhost:XXXXX/Examples/

      首先的问题,我已经是:页面试图加载本地主机:XXXX / ExtJS的/库,这不是MVC式的搜索结果
      这是由@ Html.X()来完成。ResourceManager的(),有一种方法,使其连接到<一个href=\"http://forums.ext.net/showthread.php?20566-Using-JSFiddler&p=88712&viewfull=1#post88712\"相对=nofollow> CDN库?甚至改变路径!??

      First issue i have is: the page tries to load localhost:XXXX/extjs/ libraries, that's NOT MVC-STYLE!

      This is done by @Html.X().ResourceManager(), there is a way to make it connect to cdn libraries ? or even change path!??

      之后可能还有其它的问题会出现,但现在我想解决这个小问题疼痛

      After that probably other problems will arise, but for now i would like to resolve this small painful issue

      推荐答案

      根据您链接到上面的Web.config文件中,我认为你缺少所需的&LT;模块&gt; &LT;处理&gt;在在Web.config 部分。所需的Web.config节中列出的README.txt。

      Based on the Web.config files you linked to above, I think you're missing the required <modules> and <handlers> sections in the Web.config. The required Web.config sections are listed in the README.txt.

      <一个href=\"http://examples.ext.net/#/Getting_Started/Introduction/README/\">http://examples.ext.net/#/Getting_Started/Introduction/README/

      下面是相应的&LT; system.webServer&GT; 从样品的Web.config部分。

      Here's the appropriate <system.webServer> section from the sample Web.config.

      示例

      <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>
      

      我不知道是什么的这不是MVC式的表示在下面的报价。你能否提供更多的解释?

      I don't know what "that's NOT MVC-STYLE" means in the following quote. Can you provide more explanation?

      首先的问题,我已经是:页面试图加载本地主机:XXXX / ExtJS的/库,这不是MVC风格

      First issue i have is: the page tries to load localhost:XXXX/extjs/ libraries, that's NOT MVC-STYLE!

      您可以prevent通过设置 .RenderScripts(ResourceLocationType.None)和<$ C渲染所需的.js和.css文件Ext.NET的ResourceManager $ C> .RenderStyles(ResourceLocationType.None)。

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

      示例

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

      您可以配置ResourceManager通过改变 ResourceLocationType.None 属性 ResourceLocationType.CDN 加载CDN文件。

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

      希望这有助于。

      这篇关于如何对设置在VS2012 MVC4项目Ext.NET 2.0吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆