开发者

Ajax load issue with MVC Pager control

We have an MVC pager control on a view, when moving to a new page with the next, previous, or page number, the page loses all of its CSS. The pager ajax loads the view into the div it's sitting in. Here's the view, moving page to page fires the controller action correctly but when the view returns the CSS is gone. Any help is mucho appreciato

<%@ 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="got开发者_JS百科oSearch(); 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> 


It was necessary to add a script reference in my view to the unobtrusive ajax file, that fixed it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜