English 中文(简体)
ASP MVC ViewData(Html.Encode())
原标题:ASP MVC ViewData from one view to another (Html.Encode())

我有一页的标签和检查箱。 在本页,在项目部署后,标签必须易于定制。

因此,我把所有标签都用在这一风格:

Html.Encode(ViewData[“lblText”)

我在“Edit Button Labels”一页上添加了一个子,只有行政部门才能看到。

当 but子被点击时,我谨提出另一种观点,即只包含两个栏的表格。 一栏需要包含现有标签,另一栏应为用户设置进入新标签的文本箱。

然后,一旦作出任何改动,我就需要永久改变原页上每个标签的“灯塔”。

我尝试利用回归观点和返回“Redirect ToAction(RedirectToAction)”的观点,将数据和时间数据传递给“Edit Button Labels”的观点,但没有成功。 我失踪的是未成年人,还是有更好的办法这样做?

最佳回答

Don t use ViewData是我说的第一件事。 回到你的看法中,这个模式包含标签。 必要时建立综合模式。

然后,为了贴上你的标签,要看一种采用相同模式的观点,允许你进入新的案文,并将结果节省到xml、db、文本档案中。

因此,你可能会有这样的模式;

public class Labels
{
  public List<string> text{ get; set; }
}

因此,在您的 d层中,无论在哪里,都用标签文本填写了标语。

阁下认为,你应当做以下工作:

<% Html.PartialView("EditLabels", Model); %>

然后,你有一部分观点,即EditLabels,它会有一些东西,如:

foreach(string item in Model)
{
  <% Html.PartialView("labelEdit", item); %>
}

最后,你有部分观点,只处理一个项目,并允许你将其称作标签Edit。

我认为,这是在多国企业中正确做法,以便把整个观点分解成功能的空白,并妥善处理这些关切。

显然,你仍然需要采取行动,担任职务并影响变化。

问题回答

暂无回答




相关问题
WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Post back complex object from client side

I m using ASP.NET MVC and Entity Framework. I m going to pass a complex entity to the client side and allow the user to modify it, and post it back to the controller. But I don t know how to do that ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required ...

asp.net mvc automapper parsing

let s say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; ...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor)...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

热门标签