Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Participant
852 Points
195 Posts
Dec 24, 2007 10:46 PM|LINK
To be sure I know what the issue is, let me repeat it back.
You're defining in your route some defaults, with id being null, the action being "Index", and page=1. With your route, you're specifying:
RouteTable.Routes.Add( new Route { Url = "[controller]/[action]/[id]", Defaults = new { action = "Index", id = (string)null, page = 1 }, RouteHandler = typeof( MvcRouteHandler ) } );
And the issue you're seeing is that if an action has an argument called "page", it's not being set to 1 - correct?
If I'm getting closer here - did you define a route the ties "page" into the Url? Like this:
RouteTable.Routes.Add( new Route { Url = "[controller]/[action]/[page]", Defaults = new { action = "List", page = 1 }, RouteHandler = typeof( MvcRouteHandler ) } );
You have to be explicit with respect to args, their name, and the Routes. Am I getting closer? :):)
robconery
Participant
852 Points
195 Posts
Re: Extra defaults bug
Dec 24, 2007 10:46 PM|LINK
To be sure I know what the issue is, let me repeat it back.
You're defining in your route some defaults, with id being null, the action being "Index", and page=1. With your route, you're specifying:
RouteTable.Routes.Add( new Route
{
Url = "[controller]/[action]/[id]",
Defaults = new { action = "Index", id = (string)null, page = 1 },
RouteHandler = typeof( MvcRouteHandler )
} );
And the issue you're seeing is that if an action has an argument called "page", it's not being set to 1 - correct?
If I'm getting closer here - did you define a route the ties "page" into the Url? Like this:
RouteTable.Routes.Add( new Route
{
Url = "[controller]/[action]/[page]",
Defaults = new { action = "List", page = 1 },
RouteHandler = typeof( MvcRouteHandler )
} );
You have to be explicit with respect to args, their name, and the Routes. Am I getting closer? :):)