2011-09-28 51 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文件,即固定它

添加脚本参考