【问题标题】:UrlHelper with ASP .Net Webforms带有 ASP .Net Webforms 的 UrlHelper
【发布时间】:2012-09-12 14:41:05
【问题描述】:

我需要能够在 ASP .Net Webforms 中动态地在我的网页中设置链接。我知道您可以在 ASP .Net 中动态设置路由。

我也想以与 ASP .Net MVC 中的 UrlHelper 类似的方式从 RouteCollection 生成 Url。到目前为止,我找不到任何说明是否可以将 ASP .Net MVC 中的 UrlHelper 与 Webforms 一起使用。

【问题讨论】:

    标签: c# asp.net .net


    【解决方案1】:

    您可能对Scott Hanselman recently blogged aboutintroduced in this blog post中的FriendlyUrls Nuget package感兴趣。

    代码示例:

    <a href='<%# FriendlyUrl.Href("~/WebForms/Edit", Item.TouristAttractionId ) %>'>Edit</a>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-15
      • 2019-07-09
      • 2016-05-30
      • 1970-01-01
      • 2016-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多