【发布时间】:2014-04-20 07:03:31
【问题描述】:
好的,我最近问了一个非常相似的问题,我得到了很好的答案。但是,我可能没有准确地表达我的问题,所以我会在这里再试一次:
这是我的看法
@using (Html.BeginForm())
{
<h3 class="editable">@Model.Title</h3>
<input type="submit" value="submit">
}
<h3> 具有 "editable" 类,在这种情况下意味着它可以由内联编辑器编辑。
@Model.Title
是我的数据库中的一个属性,我希望能够使用 inline-editor 进行更改。
这段代码会产生同样的结果:
@using (Html.BeginForm())
{
<h3 class="editable">@Model.Title</h3>
<input type="text" id="testinput" name="testinput" />
<input type="submit" value="submit">
}
Controller:
[HttpPost]
public ActionResult FAQ(string testInput)
{
page.Title = testInput;
return View();
}
尽管如此,这并没有使用我想要的内联编辑器。
有没有办法将<h3> 视为textbox 允许我将其中的任何内容发送到控制器?
我想明确表示我不想直接将@model.title 发送给控制器。
我想发送通过单击<h3> 并使用内联编辑器更改它创建的值。
谢谢!
【问题讨论】:
-
您可能需要拥有自己的框架或使用现有的框架来执行此操作,名为 x-editable。
标签: c# asp.net-mvc inline-editing