如何在代码隐藏页面中绑定href链接中的URLrouting [英] how to bind URLrouting in href link from codebehind page
本文介绍了如何在代码隐藏页面中绑定href链接中的URLrouting的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这里绑定来自数据库的
i用于编码以下路由URL,但我无法使用确切页面重定向,
哪个url我绑定到href标记,浏览器URL中显示相同的数据。
in .cs page
global.asax页面中的
私人 静态 void RegisterRoutes()
{
System.Web.Routing.RouteTable.Routes.Add( < span class =code-string> Gallery, new System.Web.Routing.Route( 图库/ {Mcatgry} / {Sbcatgry},
新系统。 Web.Routing.PageRouteHandler( 〜/ new_gallery.aspx)));
}
得到错误网址
http:// localhost:51668 / xxxx /%3C%$ RouteURl:Routename = Gallery,Mcatgry =油%20Pastels,Sbcatgry = TT %% 3E
预期网址
localhost:51668 / xxxx / Gallery / Oil / TT
解决方案
RouteURl:Routename = Gallery,Mcatgry = Oil%20Pastels,Sbcatgry = TT %% 3E
预计网址
localhost:51668 / xxxx / Gallery / Oil / TT
I am binding here href link in
i used below coding to routing the URL but i am unable to redirect with exact page,
which url i am binding into the href tag, the same data displaying in browser URL.
in .cs page
in global.asax page
private static void RegisterRoutes()
{
System.Web.Routing.RouteTable.Routes.Add("Gallery", new System.Web.Routing.Route("Gallery/{Mcatgry}/{Sbcatgry}",
new System.Web.Routing.PageRouteHandler("~/new_gallery.aspx")));
}
getting error url
http://localhost:51668/xxxx/%3C%$RouteURl:Routename=Gallery,Mcatgry=Oil%20Pastels,Sbcatgry=TT%%3E
EXpecting URL
localhost:51668/xxxx/Gallery/Oil/TT
解决方案
RouteURl:Routename=Gallery,Mcatgry=Oil%20Pastels,Sbcatgry=TT%%3E
EXpecting URL
localhost:51668/xxxx/Gallery/Oil/TT
这篇关于如何在代码隐藏页面中绑定href链接中的URLrouting的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文