ASP.NET MVC - get list of objects from query string

后端 未结 5 936
鱼传尺愫
鱼传尺愫 2020-12-19 11:25

I\'m passed a list of parameters. Such as \"Name\", \"Id\", \"Type\". There will be an many of these in url, like so:

\"Name=blah1,Id=231,Type=blah1;Name=         


        
5条回答
  •  失恋的感觉
    2020-12-19 11:55

    You can you a values provider, and it will populate values from the querystring into a single object. This is what you would do if you're not going to create a View Model.

    Transform the QueryString into a FormCollection via:

    var GetCollection = new FormCollection( Request.QueryString );
    

提交回复
热议问题