English 中文(简体)
在申请表2中,儿童行动/部分观点没有得到响应。
原标题:Child action/partial view is not being rendered when called in asp.net mvc 2 application

我确信,这只是很小的(或可能是大的),但我的儿童行动没有奏效。 我有一份带有年价值的清单。 该名单将通过部分控制显示。 我看到,在我通过该守则时,各自的法典已经执行,但该页上没有任何内容。

儿童行动:

    [ChildActionOnly]
    public ActionResult GetYearList()
    {
        return PartialView(_FormService.getYears());
    }

家长认为:

<% using (Html.BeginForm()) {%>
    <%= Html.ValidationSummary(true) %>
    Select Year: <% Html.Action("GetYearList"); %>

部分 观点法典:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<SelectListItem>>" %>

<% if (Model != null)
   { %>
        <% Html.DropDownList("Year", Model, "Select  Year"); %>
<% } else { %>
    <p> No Years Found </p>
<% }  %>    

任何把我做的错做什么? 我只能把部分观点直接放在一边,但我真的想说明儿童行动是如何发挥作用的,因此,如果这一逻辑更加复杂的话,我会在今后加以利用。

<><>strong>

Silly semantics。 • 改变我“Get YearList”的部分观点:

    <%= Html.DropDownList("Year", Model, "Select 1099 Year") %>

而不是

<% Html.DropDownList("Year", Model, "Select  Year"); %>

Darin说,父母的同类观点:

change  Select Year: <% Html.Action("GetYearList"); %>

to <%= Html.Action("Get1099YearList") %> 
最佳回答

你们正在援引儿童行动,但并没有做任何事情来达到产出:

<% Html.Action("GetYearList"); %>

应当成为:

<%= Html.Action("GetYearList") %>

或者如果你选择:

<% Html.RenderAction("GetYearList"); %>

对那些可能感兴趣的人来说,他们的拉扎尔等同物:

@Html.Action("GetYearList")
@{Html.RenderAction("GetYearList");}
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签