asp.net mvc - Route with nullable parameter problem -


I have a page where you edit the "UserGroup" and I have it in my controller:

Public Action Result UsergroupEdit (int? UsergroupID)

Both edit and create on the same view.

and global.asa:

  routes. MapRoute ("AdminUsergroupEdit", "Admin / Usergroup / Edit / {usergroupID}", New {controller = "UsergroupsAdmin", Action = "UserGroup Edit"}); Routes.MapRoute ("AdminUsergroupCreate", "Admin / Usergroup / Edit /", New {controller = "UsergroupsAdmin", Action = "UsergroupEdit"});  

And it works when using:

  Html.ActionLink ("Edit", "UsergroupEdit", New {usergroupID = Model.Usergroup .UsergroupID})  

But this is not a match, what's the problem with it?

  html.ActionLink ("Create", "UserGroup Edit")  

How can I create it in both cases? Since "UsergroupID" is tap, but in both cases should that action match?

html Use the HTMLActionLink instead of the route link :

  HTML. Root Link ("Create", "AdminUsergroupCreate", New RootValuation {{"Action", "UserGroup Edit"}})  


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -