Hi,
How to CREATE multiple Routes(pages) FOR URL Routing if i register more than one page then only first one is working 2nd one is not working.
<asp:HyperLink ID="HyperLink1" runat="server" href='<%# GetRouteUrl("RouteForArticle", new {id = Eval("ReciterId"), Title= GetTitle(Eval("ReciterName"))})%>' Text='<%# Eval("ReciterName") %>'>
</asp:HyperLink>
<asp:HyperLink ID="HyperLink1" runat="server" href='<%# GetRouteUrl("RouteForCat", new {id = Eval("id"), Title= GetTitle(Eval("Title"))})%>' Text='<%# Eval("Title") %>'>
</asp:HyperLink>
code behind - REPLACING space
protected string GetTitle(object obj)
{
return obj.ToString().Replace(' ', '-');
}
global.asax
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterCustomRoutes(RouteTable.Routes);
}
void RegisterCustomRoutes(RouteCollection routes)
{
routes.MapPageRoute("RouteForArticle", "{title}_{id}", "~/ReciterDetails.aspx");
routes.MapPageRoute("RouteForCat", "{title}_{id}", "~/Details.aspx");
}
regards