0

ラジオボタンをクリックすると、ページのスタイル(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 />&nbsp;&nbsp;&nbsp;&nbsp;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 />&nbsp;&nbsp;&nbsp;&nbsp;<%: 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 />&nbsp;&nbsp;&nbsp;&nbsp;<%: 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>

コントローラのメソッド

[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);
}
4

1 に答える 1

1

あなたのTop100_AllerTijden見解は部分的な見解にすぎないようです。あなたのページは

<%= Html.Action("Top100_AllerTijden", new { AOverzicht = ViewBag.Overzicht })%>

エントリのリストを部分ビューとしてレンダリングします。Top100_AllerTijdenPOSTアクションの結果を返すのではなく、ページ全体を表示するアクションにリダイレクトする必要があります。

[HttpPost]
public ActionResult Top100_AllerTijden(FormCollection ACollection)
{
    string sOverzicht= ACollection["Overzicht"].ToString();
    return RedirectToAction("NameOfTheActionWhichDisplaysTheWholePage", new { overzicht = sOverzicht })
}
于 2012-09-12T12:35:40.893 に答える