【问题标题】:Asp.Net MVC Assembly Reference ErrorAsp.Net MVC 程序集参考错误
【发布时间】:2014-08-02 12:00:06
【问题描述】:

我添加了引用 system.web.routing dll 并在所有页面中添加了命名空间,并在 web.config 页面中添加了,但是这里添加查询字符串参数行中的错误。有人能找出错误并说出答案吗?

 var isDescending = string.CompareOrdinal(Model.SortBy, ViewData["ColumnName"].ToString()) == 0 && Model.SortAscending;
    var routeData = new RouteValueDictionary { { "sortBy", ViewData["ColumnName"].ToString() }, { "ascending", !isDescending } };

// Add in the querystring parameters *except* for the paging ones (as sorting should send us back to the first page of data)
routeData.AddQueryStringParameters().ExceptFor("page", "pageSize");

var htmlAttributes = new Dictionary<string, object>();
if (string.CompareOrdinal(Model.SortBy, ViewData["ColumnName"].ToString()) == 0)
{
    if (Model.SortAscending)
    {
        htmlAttributes.Add("class", "sortAsc");
    }
    else
    { 
        htmlAttributes.Add("class", "sortDesc");
    }
}

}

【问题讨论】:

    标签: asp.net-mvc-4


    【解决方案1】:

    你已经添加了 system.web.routing dll,你已经在所有页面中添加了命名空间,还添加了 web.config 页面,你说的很好

    所以你必须删除这一行并运行程序,你肯定会得到输出

     routeData.AddQueryStringParameters().ExceptFor("page", "pageSize");
    

    【讨论】:

      猜你喜欢
      • 2018-12-13
      • 1970-01-01
      • 1970-01-01
      • 2010-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多