网页中的 Html 助手(来自 asp.net mvc)

发布于 2024-12-22 10:55:11 字数 309 浏览 9 评论 0原文

是否可以在网页(cshtml)中使用 MVC Helpers?

我正在尝试一些来自 infragistics 的控件,并且想使用 html 帮助器方法来创建网格(避免一些 JavaScript),但我似乎无法获得任何智能感知。

不,我不确定它是否有效?

更新:我想使用以下行:

@Html.Infragistics().Grid(....

在我的 MyWebPagesPage.cshtml 中

感谢您的帮助

Larsi

Is it possible to use MVC Helpers in webpages (cshtml) ?

I'm trying out some controls from infragistics, and would like to use the html helper method to create the grid (avoiding some javascript) but I can't seem to get any intellisense.

No, I'm unsure if it should work?

Update: I want to use the following line:

@Html.Infragistics().Grid(....

inside my MyWebPagesPage.cshtml

Thanks for any help

Larsi

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

椒妓 2024-12-29 10:55:11

您应该能够,只需添加
@using infrajistics.namespace

您还可以将命名空间添加到您的 web.config 命名空间部分,这样您就不必在每个视图中添加 @using

You should be able to, just add
@using infrajistics.namespace

You could also add the namespace to ur web.config namespaces section so that you don't have to add the @using in each view

葬花如无物 2024-12-29 10:55:11

没有可以渲染 Infragistics 控件的辅助方法。请查看 此页面,有MVC页面中使用Infragistics控件的详细说明。

但也有一些限制。 Infragistics 没有单独的 MVC 控件,他们只是提供了 asp.net 控件,但有一个缺点。

只要您关注不启动回发或不依赖 ViewState 的控件区域,您很快就会发现许多行为和功能在 ASP.NET MVC 应用程序中完美运行。

示例用法如下:

<%@ Register Assembly="Infragistics.Web.Mvc" Namespace="Infragistics.Web.Mvc" TagPrefix="cc1" %>
<%@ Register Assembly="Infragistics35.Web.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>

<ig:WebDataGrid ID="wdg" 
        runat="server" Width="50%" 
        EnableViewState="false">
    </ig:WebDataGrid>

不涉及 MVC 帮助程序。

There are no helper method that would render Infragistics controls. Please take a look at this page, it has detailed instructions of using Infragistics controls in MVC pages.

There are some limitations though. Infragistics doesn't have separate controls for MVC, they are simply making their asp.net controls available, but there's a drawback.

As long as you focus on areas of the controls that do not initiate post backs or rely on ViewState, you soon find many behaviors and functions that work perfectly in an ASP.NET MVC application.

Sample usage would be:

<%@ Register Assembly="Infragistics.Web.Mvc" Namespace="Infragistics.Web.Mvc" TagPrefix="cc1" %>
<%@ Register Assembly="Infragistics35.Web.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>

<ig:WebDataGrid ID="wdg" 
        runat="server" Width="50%" 
        EnableViewState="false">
    </ig:WebDataGrid>

No MVC helpers involved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文