TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Terry
NA
148
0
Routing doesn't work with anchor and/or asp:HyperLink !!!!
Jun 3 2015 7:41 AM
Hi,
in my asp.net 4.5 WebForms app, I have implemented Routing. In mt RouteConfig.cs I have added :
routes.MapPageRoute("Import", "Import/{ImportType}", "~/Views/ImportData.aspx");
When I am using the route like below, it is working perfectly well :
Response.RedirectToRoute("Import", new { ImportType = "Channel" });
I have a menu, where I want to redirect to the above route. So I used :
<li class="menu-green"><a runat="server" href='<%# GetRouteUrl("Import", new { ImportType = "Inquiry"} ) %>'>Import</a></li>
Instead of <a> I tried using <asp:Hyperlink>, but none of them works. On checking the source at execution, I found that anchor/hyperlink tag has no href or is blank.
When I made it as LinkButton & implemeted onClick event in code behind & used the Response.Redirect, that is again working.
Why I am not able to redirect it thru anchor at hyperlink in the menu ??
Any ideas. Is my GetRouteUrl code wrong Or do I need to add any thing in aspx ??
Reply
Answers (
0
)
On change is not working
What is web job in Azure