asp.net mvc 4 - MVC 4 Get Parameters in Action -


i working on mvc 4 web project. , have code tihs,

public actionresult index(string param1, string param2, ...) {     return view(); } 

i need list list have parameters name not value. (its sample)

list<string> list = { param1, param2, ... } 

code write me, write above return view(); code. how can write string list parameters name? thanks.

that depends on parameters came from. if request, parameters passed live in request.querystring collection, , should able this:

list<string> list = request.querystring.allkeys.tolist(); 

if form post, should create formcollection object (taken here):

var form = new formcollection(controllercontext.httpcontext.request.form); list<string> list = form.allkeys.tolist(); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -