English 中文(简体)
你们如何把尿道带价值定在高链条上,把尿素财产加在一页。
原标题:how do you set a url routing routevalue to a hyperlink s navigate url property in an aspx page?

如果路线如下:

 routes.MapPageRoute(
           "Build",      // Route name
           "build",      // Route URL
           "~/build.aspx" // Web page to handle route
        );

     routes.MapPageRoute(
       "Type",      // Route name
       "build/{type}",      // Route URL
       "~/build.aspx" // Web page to handle route
    );

       routes.MapPageRoute(
       "Project",      // Route name
       "build/{type}/{project}",      // Route URL
       "~/build.aspx" // Web page to handle route
    );

 routes.MapPageRoute(
       "Task",      // Route name
       "task/{type}/{project}",      // Route URL
       "~/task.aspx" // Web page to handle route
    );

我如何将超文本链接在(而不是后面编码)上设定为“哪类=工具和项目=超负荷工作”的路线上?

最佳回答

例如,在电网观测模板领域:

  <asp:TemplateField>
    <ItemTemplate>
      <asp:HyperLink runat="server" ID="btnUp" Text= <%# Eval("ProjectID") %> 
        NavigateUrl= <%# GetRouteUrl("Task",
          new System.Web.Routing.RouteValueDictionary
          {
            {"type", "tool" },
            {"project" , "excel" }
          }) %>  />
    </ItemTemplate>
  </asp:TemplateField>

或者,你可以从数据来源确定参数:

  <asp:TemplateField>
    <ItemTemplate>
      <asp:HyperLink runat="server" ID="btnUp" Text= <%# Eval("ProjectID") %> 
        NavigateUrl= <%# GetRouteUrl("Task",
          new System.Web.Routing.RouteValueDictionary
          {
            {"type", Eval("Type") },
            {"project" , Eval("ProjectType") }
          }) %>  />
    </ItemTemplate>
  </asp:TemplateField>
问题回答

页: 1 例如,你可以制定这样一个路线:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="<%$RouteUrl:RouteName=Project, type=1, project=2%>">Type 2</asp:HyperLink>

你们可以确定这样的路线价值。

<asp:HyperLink ID="lnk3" runat="server" NavigateUrl="<%$RouteUrl:Name=IPhone,ID=1 %>" Text="IPhone" />

在全球,我的组合也一样。

RouteTable.Routes.MapPageRoute("StoreRoute",
"BookStore/{Name}/{ID}",
"~/Webpages/BookStore/ViewBookDemo.aspx");




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签