注册在MVC3 ASPX局部视图自定义控件 [英] Register custom control in MVC3 ASPX Partial view

查看:180
本文介绍了注册在MVC3 ASPX局部视图自定义控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问一个相关的问题<一href=\"http://stackoverflow.com/questions/9514327/convert-use-cusom-control-in-asp-net-to-mvc3-razor-view\">here当我发现有没有办法使用剃刀意见自定义控件,所以我可以添加新的ASPX局部视图中使用自定义的控制,我的自定义控件的是,我加入引用然后定义局部视图如下面的一个dll:

I ask a relevant question here and as I find there is no way to use custom control in Razor views, so I get to add new ASPX partial view to use custom control, my custom control is a dll that I added to References then define Partial view as the following:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>
<%@ Register Assembly="JQControls" Namespace="JQControls" TagPrefix="PersianDatepicker" %>
<PersianDatepicker:JQLoader ID="jqdb" runat="server" />
<PersianDatepicker:JQDatePicker ID="jqdp1" runat="server" Regional="fa" />

我写ASPX Web表单的确切code和工作正常,但有一个例外,在MVC:

I write the exact code in ASPX Web form and worked correctly but there is an exception in MVC:

Error executing child request for handler 
'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'.

Exception of type 'System.Web.HttpUnhandledException' was thrown.

Object reference not set to an instance of an object.

所以没有任何一个有什么想法呢?

So does any one have any idea about it?

另一个问题是,我该怎么定义的HTML帮助该用户控件(dll的,我还没有获得code)?

Another question is how can I define a Html Helper for this user control (With dll and I have not access to code) ?

推荐答案

做一个HTML IFRAME眼帘,加载一个aspx页面!

make a html iframe into view, loading a aspx page!

这篇关于注册在MVC3 ASPX局部视图自定义控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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