如何在模型中创建动态属性并在Controller和View中使用. -MVC [英] How do i create dynamic properties in Model and use in Controller and View. - MVC
问题描述
我正在寻找一种解决方案,该解决方案可以创建要在Model中创建的动态属性.
I am looking for a solution which creates dynamic properties to be create in Model.
我想在我的View and Controller中使用它们.
I want to use them in my View and Controller.
任何人都有想法,如何创建它?
Can any one have idea, how to create it?
我的项目中有一个场景,其中一页将具有选项,例如Profile2,Profile5等.
I am having scenario in my project where one page will be having options to be lets say Profile2, Profile5 etc.
个人资料2可以有两个要从用户提交的URL.
Profile 2 can have two URLs to be submit from user.
配置文件5可以具有五个要从用户提交的URL.
Profile 5 can have five URLs to be submit from user.
和
等等........
So on........
是否有解决方案或替代方案?
Is there any solution or alternative to do this????
推荐答案
He Amit,针对您的情况我的项目中有一个场景,其中一页将具有选项Profile2,Profile5等.
He Amit , For your situation "I am having scenario in my project where one page will be having options to be lets say Profile2, Profile5 etc.
个人资料2可以有两个要从用户提交的URL.
Profile 2 can have two URLs to be submit from user.
配置文件5可以包含五个要使用的URL"
Profile 5 can have five URLs to be submit from use"
您希望将此url放入您的属性中. 因此,要做一件事就是创建这样的属性.
You want to put this url in your properties ok. SO do one thing create a property like this.
public List<string> urlList {get;set;}
在您的媒体资源中使用此代码,然后在列表中添加url. 您可以添加n个网址.
use this in your property andd add url in the list. you can add n no of urls.
这篇关于如何在模型中创建动态属性并在Controller和View中使用. -MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!