2011-09-28 53 views
0

我們有一個MVC頁面控制視圖,當移動到一個新的頁面與下一個,上一個,或頁碼,頁面失去了所有的CSS。 pager ajax將視圖加載到它所在的div中。以下是視圖,將頁面移動到頁面會正確觸發控制器操作,但是當視圖返回CSS時,頁面將不再顯示。任何幫助是MUCHO appreciatoAjax加載問題與MVC尋呼控制

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of PagedList(Of ClarifirePortal.PortalAnnouncement))" %> 
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %> 

<script type="text/javascript" > 

    function gotoSearch() { 

     window.location.href = '<%:URL.Action("Search","Home") %>'; 
    } 

    function openDIV(divID) { 

     var ele = document.getElementById(divID); 

     if (ele.style.display == "block") { 
      ele.style.display = "none"; 
      } 
     else { 
      ele.style.display = "block"; 
     }   
    } 

</script> 

<br /> 
<div id="divPortal"> 
<%If Model IsNot Nothing AndAlso Model.Count > 0 Then%> 
    <br /> 
    <% Using Html.BeginForm("Search", "Home", FormMethod.Post, New With {.id = "PortalForm"})%> 
     <table width="98%"> 
      <tr> 
       <td> 
        <%: ViewData("WebStatus")%><br /><br /> 
       </td> 
      </tr>    
      <tr> 
       <td> 
        <% If ViewData("Enabled") = False Then%> 
         <input type="submit" value="Continue" class="t-button" name="Continue" onclick="gotoSearch(); return false;" /> 
        <% End If%> 
       </td> 
      </tr>   
      <tr> 
       <td> 
        <br /> 
        <br /> 
         <table width="100%" style="border: 2px solid #4675bb;"> 
          <tr> 
           <td> 
            Announcements 
           </td> 
          </tr> 
          <% For Each oAnnouncement As ClarifirePortal.PortalAnnouncement In Model%> 
          <tr> 
           <td align="left" style="width: 500px;"> <a href='void();' onclick='openDIV(<%:oAnnouncement.contentID %>); return false;' class="eMasonLink"> 
            <%: oAnnouncement.DatePosted & "-" & oAnnouncement.Title%></a><br /> 
            <%: oAnnouncement.ShortDescription%> 
           </td> 
          </tr>        
          <%Next%>     
          <tr> 
           <td colspan="1"> 
            <%:Html.AjaxPager(Model, "LoadStatus", "Home", New PagerOptions() With {.PageIndexParameterName = "portalPage", .ShowDisabledPagerItems = False, .AlwaysShowFirstLastPageNumber = True}, New AjaxOptions With {.UpdateTargetId = "divPortal"})%> 
           </td> 
          </tr> 
         </table> 
       </td>   
      </tr>   
     </table>     
    <%End Using%> 
<%Else %> 
    <br /> 
    <% Using Html.BeginForm()%> 
    ... 
    <%End Using%> 
<%End If%> 
</div> 

回答

0

有必要在我看來,以不顯眼的AJAX文件,即固定它

添加腳本參考