ASP.NET MVC 2 actionlink breaking after migration from MVC version 1

Posted by thermal7 on Stack Overflow See other posts from Stack Overflow or by thermal7
Published on 2010-02-16T23:08:59Z Indexed on 2010/03/25 3:53 UTC
Read the original article Hit count: 503

Filed under:
|

Hi,

I am migrating my application from asp.net mvc to mvc version 2 and am having the following issue.

I have paging links << < > >> that I include in each page. Like so:

        <% Html.RenderPartial("PagingControl", Model); %>

They exist in an ascx file as follows.

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BankingDB.Controllers.Utility.IPagedSortedObject>" %>
    <div class="paging">
        <div class="previous-paging">
<!- error!! -><%= Model.HasPreviousPage ? Html.ActionLink("<<", "Index", Model.buildParams(1)) : "<<"%>
            <%= Model.HasPreviousPage ? Html.ActionLink("<", "Index", Model.buildParams(Model.PreviousPageIndex)) : "<"%>
        </div>
        <div class="paging-details">
            Showing records <%= Model.BaseRecordIndex %> to <%= Model.MaxRecordIndex %> of <%= Model.TotalRecordCount %>
        </div>
        <div class="next-paging">
            <%= Model.HasNextPage ? Html.ActionLink(">", "Index", Model.buildParams(Model.NextPageIndex)) : ">"%>
            <%= Model.HasNextPage ? Html.ActionLink(">>", "Index", Model.buildParams(Model.PageCount)) : ">>"%>
        </div>        
    </div>

When I try to access the page I get the error:

CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between 'System.Web.Mvc.MvcHtmlString' and 'string'

The error is marked above and appears to be with the action link. Including the controller name doesn't help. Any ideas?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about asp.net-mvc