.net核心MVC路由 [英] .net core MVC routing

查看:83
本文介绍了.net核心MVC路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在自己的viewcomponent中有四个下拉菜单。



我不想对用户如何选择它们下一个订单 - 每个都会​​过滤内容其他三个和用户的视角将决定他们从哪一个开始。



顺序路线将是:



~ / Home / Index / Param1 / Param2 / Param3 / Param4



假设用户从列表4中选择 - 这会产生一个回发帖子

~ / Home / Index / Param4



然后是1(但不会丢失选择4),触发

~ /主页/索引/参数1 /参数4



这是可能的还是我必须按顺序或使用键/值字典作为单个参数?



我尝试了什么:



我尝试了一个catchall参数路线,初始测试并不令人鼓舞。

解决方案

现在我想要引入一个新的引导参数名为journeySelectors。



将询问journeySelectors的值,以决定四个驾驶参数中需要处理的值。



journeySelectors将遵循来自github的enDays此处的示例

I have four dropdowns each in its own viewcomponent.

I dont want to impose an order on how the user select from them - each one will filter the contents of the other three and the perspective of the user will govern which one they start from.

Taken in order the route would be:

~/Home/Index/Param1/Param2/Param3/Param4

Assume the user chooses from list 4 - this generates a post back
~/Home/Index/Param4

And then 1 (but not loosing choice 4), triggering
~/Home/Index/Param1/Param4

Is this possible or do I have to go in order or use a key/value dictionary as a single parameter?

What I have tried:

I have tried a catchall parameter on the route, initial tests are not encouraging.

解决方案

Now Im thinking of introucing a new lead parameter called "journeySelectors".

The value of "journeySelectors" will be interrogated to decide what of the four driving parameters have values need to be handled.

"journeySelectors" will follow the example of "enDays" here from github


这篇关于.net核心MVC路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆