asp.net mvc 3 - mvc3 Routes setup as id, id2 id3 -
i have following area routes setup.
context.maproute( "admin_default3", "admin/{controller}/{action}/{id}/{id2}/{id3}", new { action = "index" } ); context.maproute( "admin_default2", "admin/{controller}/{action}/{id}/{id2}", new { action = "index"} ); context.maproute( "admin_default", "admin/{controller}/{action}/{id}", new { action = "index", id = urlparameter.optional } );
when controller action hit following place params readable variable names.
public actionresult search(guid? id, int? id2, bool? id3) { guid? source = id; int daysold = id2; bool includenonenglish = id3; //.... action! }
should continue way? should create plethora of routes?
thank
i create more routes. way, have things like:
html.actionlink(title, "action", "controller", new { source = <value>, daysold = <value>, includenonenglish = <value> });
instead of:
html.actionlink(title, "action", "controller", new { id = <value>, id2 = <value>, id3 = <value> });
among other things (like ajax calls jquery, use json specifying parameters). make things more readable. if you're using, or going use, t4mvc.
Comments
Post a Comment