开发者

asp.net mvc - how to pass more than 1 default paramters when mapping routes

I am trying to pass more that 1 default parameters when mapping a route i.e

routes.MapRoute(
            null, 
            "items", 
            new { controller = "Items", action = "Ind开发者_如何学Cex",  new { page = 1, pageSize=10 } } //prob here
        );

Works fine with 1 parameter like:

routes.MapRoute(
            null, 
            "items", 
            new { controller = "Items", action = "Index",  page = 1 } //prob here
        );

Thanks in advance


You are already declaring three default parameters here:

new { controller = "Items", action = "Index",  page = 1 }

Adding a fourth is as simple as:

new { controller = "Items", action = "Index",  page = 1, pageSize=10 }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜