What is the best way to share a common Partial View between applications? I've created a separate assembly containing my Partial View in an ascx file, some scripts that go with that view and an HtmlHelper extension method to make creating the partial view easier. However, when referencing that assembly from an ASP.NET MVC application, it can't find the partial view as the ascx file is not copied as well. Also, what is the best way of including the attached scripts with the application? The only way I can see at the moment is to copy the relevant files to the new application.

在应用程序之间共享公共部分视图的最佳方法是什么?我在ascx文件中创建了一个包含我的部分视图的独立程序集,一些与该视图一起使用的脚本和一个HtmlHelper扩展方法,可以更轻松地创建局部视图。但是,从ASP.NET MVC应用程序引用该程序集时,它无法找到部分视图,因为ascx文件也未复制。此外,将附加脚本包含在应用程序中的最佳方法是什么?我目前唯一能看到的方法是将相关文件复制到新的应用程序中。

4 个解决方案

#1


7

A nice question indeed.

确实是个好问题。

I would suggest avoiding ascx files and generating HTML manually in your HTML helpers. TagBuilder class does a great deal of help here.

我建议避免使用ascx文件并在HTML帮助程序中手动生成HTML。 TagBuilder类在这里提供了很多帮助。

更多相关文章

  1. 如果外部应用程序更改了持久模型(服务器数据库),AngularJS可以自
  2. 如何在rails中使用ajax将数据从控制器传递到视图
  3. 在两台服务器上有效地在两个Django应用程序之间进行通信(多租户)
  4. django的视图和URL配置
  5. 如何停止Py_Initialise应用程序的崩溃?
  6. Python Flask WTForms:如何在视图中动态禁用字段?
  7. 轮询Web服务的最佳方式(例如,对于Twitter应用程序)
  8. 乘客的Django应用程序显示空主页
  9. Django反向url与参数到基于类的视图

随机推荐

  1. Android及系统架构目录结构介绍
  2. android实现gif图与文字混排
  3. Android(安卓)WindowManager悬浮窗:不需要
  4. Android布局自定义Shap圆形ImageView,可以
  5. android解析xml文件的方式(其一)
  6. Android开发者已经度过了初级吗
  7. Fedora 下配置 Android 开发环境
  8. Android(安卓)listview与adapter用法
  9. Android(安卓)Fragment 真正的完全解析(下
  10. Android面试系列文章2018之Android部分之