导航到路由的超链接的url属性 [英] navigate url property of hyperlink to the route

查看:118
本文介绍了导航到路由的超链接的url属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在global.asax文件中创建了一条路线,如下所示:

i have created a route in the global.asax file like below :

routes.MapPageRoute("Selected Category", "{parent}/{child}", "~/Products.aspx");





之后我试图设置routeurl属性的超链接到路由网址。但它不是创建导航链接..它仍然是空的..应该是可能的原因..我在下面的代码做错了什么..任何帮助将不胜感激。





After that i am trying to set navigateurl property of hyperlink to the route url. But it is not creating navigation link.. It remains empty.. what should be the possible reason.. Am i doing something wrong in the below code.. Any help would be appreciated.

<asp:HyperLink ID="HyperLink8" runat="server" NavigateUrl='<%# GetRouteUrl("Selected Category", new {parent = "Fashion" , child= "category1"}) %>'>Privacy Policy</asp:HyperLink>

推荐答案

请尝试以下两项修改: -



1。请从路径名称中删除空格意味着将选定类别更改为SelectedCategory。

2.使用NavigateUrl如下: -

Please try with the below two modifications :-

1. Please remove the space from the route name means change 'Selected Category' to 'SelectedCategory'.
2. Use NavigateUrl as below :-
NavigateUrl='<%= Page.GetRouteUrl("SelectedCategory", new RouteValueDictionary(new {parent = "Fashion" , child= "category1"})) %>'







希望您对此提示有所帮助。




Hope you will be helpful with this hints.


这篇关于导航到路由的超链接的url属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆