Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RouteData.Values is always empty

Status
Not open for further replies.

pmbtech

Programmer
Nov 24, 2003
47
0
0
US
I am using .Net 4.0 Routing and IIS 5.1

I have set up a test route as :
routes.MapPageRoute("onlineuniversity-catalog",
"onlineuniversity/catalog.aspx/{category}/{coursetype}",
"~/onlineuniversity/catalog.aspx");

I set up 3 test nav links as:
In Markup :
NavigateUrl="<%$RouteUrl:category=Insurance,coursetype=ContinuingEducation,routename=onlineuniversity-catalog%>"
NavigateUrl="~/OnlineUniversity/catalog.aspx/Insurance/ExamPrep">

and in Code behind as:
RouteValueDictionary parameters = new RouteValueDictionary
{
{"category", "Insurance" },
{ "coursetype", "PreLicense" } ,
};
VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, "onlineuniversity-catalog", parameters);
MenuOnlinePreLicense.NavigateUrl = vpd.VirtualPath;


All 3 links work and get me to the target page;
The target page checks the RouteData values in the page_load:
string sCategory = Page.RouteData.Values["category"].ToString();
string sCourseType = Page.RouteData.Values["coursetype"].ToString();

No matter which link I use RouteData.Values.Count = 0

Does anybody have any ideas why? I have been googling for about an hour to no avail.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top