且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Asp.Net URl Routing ..无法将Querystring从一个页面传递到另一个页面

更新时间:2023-01-08 13:33:13

我可以添加像这样的href

< a href =../ Articleinfo /<%#Eval(artcile_id =)%>>< / a> 

这可以解决我的问题......


I am trying to use Routing in pages for my website. When user click category name then i can passed catid into ArticlesList.aspx page...if user clicks particular Article then i need to pass article id into articledetails.aspx page...
when i am trying to click particular article its not working...
when articlelist page is loaded if catid is 1 then url like this http:local/mysite/Articlelist/1

when i am click one article then url like http:local/mysite/Articlelist/Articleinfo/10 its a problem....if i am manualy given a url like http:local/mysite/Articleinfo/10 - its working...How to solve this problem...Give me a suggestions plz?


global.asax file:

void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("", "Articlelist/{catid}", "~/ArticlesList.aspx");
routes.MapPageRoute("", "Articleinfo/{artid}", "~/articledetails.aspx");
}

I can add a href like this
<a href="../Articleinfo/<%# Eval(" artcile_id=") %>"></a>

this can be solved my problem...