为什么单击单选按钮会消除样式(来自css)和页面的菜单栏?仅显示页面内容。
这是页面
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" >
<% using (Html.BeginForm("Top100_AllerTijden", "Top100", FormMethod.Post, new { id = "frmTop100" })) %>
<% { %>
<table>
<tr><th width="1000" align="left">Selecteer jaar:</th></tr>
<tr>
<td>
<%= Html.RadioButton("Overzicht", "S", new
{
@onclick = "document.getElementById('frmTop100').submit();"
}) %> Singlesoverzicht
</td>
</tr>
<tr>
<td>
<%= Html.RadioButton("Overzicht", "A", new
{
@onclick = "document.getElementById('frmTop100').submit();"
})%> Albumsoverzicht
</td>
</tr>
</table>
<br />
<br />
<div>
<%= Html.Action("Top100_AllerTijden", new { AOverzicht = ViewBag.Overzicht })%> <br />
</div>
<% } %>
</asp:Content>
内部的UserControl:
<table>
<tr>
<th width="75" align="right" valign="top">Notering</th>
<th width="750">Titel<br /> Artiest</th>
<th width="50" align="center" valign="bottom">Product</th>
<th width="50" align="center" valign="bottom">Jaar</th>
</tr>
<% foreach (var item in Model) { %>
<% if (item.Notering == 1)
{
%>
<tr class="notering_1">
<td width="75" align="right" valign="top"><%: item.Notering%></td>
<td width="750"><%: item.Titel%><br /> <%: item.Artiest%></td>
<% if (item.Product == "N")
{ %>
<td width="50" align="center" valign="bottom">
<img src="<%= Url.Content( "~/images/Nederland.jpg" ) %>"
alt="alt text" height="16" width="16" />
</td>
<% }
else if (item.Product == "B")
{ %>
<td width="50" align="center" valign="bottom">
<img src="<%= Url.Content( "~/images/België.jpg" ) %>"
alt="alt text" height="16" width="16" />
</td>
<% }
else
{ %>
<td width="50" align="center" valign="bottom"></td>
<% } %>
<td width="50" align="right" valign="bottom"><%: item.Jaar%></td>
</tr>
<% } else { %>
<tr>
<td width="75" align="right" valign="top"><%: item.Notering %></td>
<td width="750"><%: item.Titel %><br /> <%: item.Artiest %></td>
<% if (item.Product == "N")
{ %>
<td width="50" align="center" valign="bottom">
<img src="<%= Url.Content( "~/images/Nederland.jpg" ) %>"
alt="alt text" height="16" width="16" />
</td>
<% }
else if (item.Product == "B")
{ %>
<td width="50" align="center" valign="bottom">
<img src="<%= Url.Content( "~/images/België.jpg" ) %>"
alt="alt text" height="16" width="16" />
</td>
<% }
else
{ %>
<td width="50" align="center" valign="bottom"></td>
<% } %>
<td width="50" align="right" valign="bottom"><%: item.Jaar %></td>
</tr>
<% } %>
<% } %>
</table>
Controller中的方法
[HttpPost]
public ActionResult Top100_AllerTijden(FormCollection ACollection)
{
string sOverzicht= ACollection["Overzicht"].ToString();
return Top100_AllerTijden(sOverzicht);
}
public ActionResult Top100_AllerTijden(string AOverzicht)
{
ReadTop100At(AOverzicht);
return View(_ListTop100Model);
}
答案 0 :(得分:1)
您的Top100_AllerTijden
视图似乎只是部分视图。您的网页使用
<%= Html.Action("Top100_AllerTijden", new { AOverzicht = ViewBag.Overzicht })%>
将条目列表呈现为部分视图。您应该重定向到显示完整页面的操作,而不是在POST操作中返回Top100_AllerTijden
的结果。
[HttpPost]
public ActionResult Top100_AllerTijden(FormCollection ACollection)
{
string sOverzicht= ACollection["Overzicht"].ToString();
return RedirectToAction("NameOfTheActionWhichDisplaysTheWholePage", new { overzicht = sOverzicht })
}