誰かが何が問題なのかを理解するのを手伝ってくれることを願っています。コントローラーを起動するための挿入コマンドを取得できず、なぜ起動しないのかわかりません。これが私のコードです:
@(Html.Telerik().Splitter().Name("AnswerOptionSplitter")
.Orientation(SplitterOrientation.Horizontal)
.Panes(panes =>
{
panes.Add()
.Size("28px")
.Resizable(false)
.Content(@<text>
<div class="entity-tools-vertical">
<button id="editAnswerOption" title="Edit" class="entity-action"><img alt="Edit" height="24" src="@Url.Content("~/Content/Common/Images/Icons/edit-disabled.png")" width="24" /></button>
<button id="moveUpAnswerOption" title="Move Up" class="entity-action"><img alt="Move Up" height="24" src="@Url.Content("~/Content/Common/Images/Icons/up-disabled.png")" width="24" /></button>
<button id="moveDownAnswerOption" title="Move Down" class="entity-action"><img alt="Move Down" height="24" src="@Url.Content("~/Content/Common/Images/Icons/down-disabled.png")" width="24" /></button>
<button id="toggleEnableAnswerOption" title="Enabled" class="entity-action"><img alt="Enabled" height="24" src="@Url.Content("~/Content/Common/Images/Icons/accept-disabled.png")" width="24" /></button>
<button id="deleteAnswerOption" title="Delete" class="entity-action"><img alt="Delete" height="24" src="@Url.Content("~/Content/Common/Images/Icons/recycle-disabled.png")" width="24" /></button>
</div>
</text>);
panes.Add()
.Resizable(false)
.Content(
@Html.Telerik().Grid<AnswerOptionViewModel>()
.Name("AnswerOptions")
.DataKeys(k => k.Add(o => o.ID))
.ToolBar(commands => commands.Insert().ButtonType(GridButtonType.ImageAndText))
.DataBinding(dataBinding => dataBinding.Ajax()
.OperationMode(GridOperationMode.Client)
.Select("_AnswerOptionsAjax", "Attribute", new { id = Model.ID })
.Update("_AnswerOptionsUpdateAjax", "Attribute", new { attributeId = Model.ID })
.Delete("_AnswerOptionsDeleteAjax", "Attribute", new { id = Model.ID })
.Insert("_AnswerOptionsCreateAjax", "Attribute", new { id = Model.ID })
)
.Columns(columns =>
{
columns.Bound(m => m.AnswerAbbr).Title("");
columns.Bound(m => m.AnswerText).Title("");
columns.Bound(m => m.AnswerValue).Title("").Width(32);
columns.Bound(m => m.RelatedImageId).Title("")
.ClientTemplate("<img alt='<#= AnswerText #>' class='answer-option-icon' src='"
+ Url.Action("AttributeAnswerOption", "ImageGenerator", new { id = Model.ID, index = 0 })
+ "' />").Width(32);
columns.Bound(m => m.RelatedImage).Hidden();
columns.Bound(m => m.Ordinal).Hidden().HtmlAttributes(new { style = "display: none;" });
})
.ClientEvents(c => c
.OnRowSelect("AnswerOptions_onRowSelect")
.OnDataBound("AnswerOptions_onDataBound")
.OnComplete("AnswerOptions_onComplete")
)
.HtmlAttributes(new { @class = "t-widget t-grid grid-no-header grid-no-footer" })
.Selectable()
.Editable(e => e.Mode(GridEditMode.PopUp))
.ToHtmlString()
);
})
)
[Key]
[ReadOnly(true)]
[ScaffoldColumn(false)]
[DisplayName("Id")]
public int ID { get; set; }
[DisplayName("Code")]
[StringLength(10)]
public string AnswerAbbr { get; set; }
[Required(AllowEmptyStrings = false)]
[DisplayName("Value")]
[StringLength(200)]
public string AnswerText { get; set; }
public int? AnswerValue { get; set; }
[DisplayName("ImageType")]
public LookupViewModel ImageType { get; set; }
public string ImageTypeValue
{
get { return (ImageType == null) ? "" : ImageType.ColumnValue; }
set
{
if (String.IsNullOrEmpty(value) == false)
{
var lookup = LookupViewModel.GetLookup("AnswerOption", "ImageType", value) ??
LookupViewModel.GetLookup("AnswerOption", "ImageType", "image/bmp");
ImageType = lookup;
}
else
ImageType = null;
}
}
//[ScriptIgnore]
public byte[] RelatedImage { get; set; }
[DisplayName("Image")]
public string RelatedImageId
{
get { return ID.ToString(); }
}
[Required]
public Int16 Ordinal { get; set; }
[Required]
public bool Enabled { get; set; }
public void ToggleEnabled()
{
Enabled = !Enabled;
}
//[Required]
//public AttributeViewModel Attribute { get; private set; }
public static AnswerOptionViewModel CreateAttributeValue()
{
var answerOption = new AnswerOptionViewModel();
[GridAction]
public ActionResult _AnswerOptionsCreateAjax(AnswerOptionViewModel model)
{
var answerOption = AnswerOptionViewModel.CreateAttributeValue();
var newId = (Attribute.AnswerOptions.Count > 0) ? Attribute.AnswerOptions.Min(ao => ao.ID) - 1 : -1;
if (newId > 0)
newId = -1;
answerOption.ID = newId;
answerOption.AnswerText = "[blank]";
if(TryUpdateModel(answerOption))
Attribute.AnswerOptions.Add(answerOption);
return View(new GridModel(Attribute.AnswerOptions));
}
何が起こっているのかを理解するのを手伝ってください。私はMVCが初めてです。前もって感謝します。