My question has 2 parts:
1
My MVC project has folder structure like so:
I want to create a link in the 'Create' page that links to the 'Savings' WebForm
I've tried adding this to the RouteConfig:
routes.MapPageRoute(
"idea-savings-calculator",
"Idea/Savings",
"~/Views/Idea/Savings.aspx"
);
but the default MVC MapRoute function:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
maps to the URL localhost:xxxx/Idea/Savings
first and throws an error because there isn't an action called savings in the Idea controller Savings.
Edit: RouteConfig Class:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
routes.MapPageRoute(
"idea-savings-calculator",
"Idea/Savings",
"~/Views/Idea/Savings.aspx"
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
2
Below is a cut from the 'Create' View of the 'Idea' Controller URL: http://localhost:51946/Idea/Create
(red box indicates where I'd like the link to the Savings WebForm
)
The Savings WebForm
is just a simple calculator; how would I pass the product from the calculations back to the above 'Create' page so that it can be displayed in the bottom text box? I'm guessing it would be as a parameter in the url that the Idea Controller can match? But... How?
Thanks!