【问题标题】:SharePoint create hyperlink with variable from current page querystringSharePoint 使用当前页面查询字符串中的变量创建超链接
【发布时间】:2012-11-22 20:50:22
【问题描述】:

试图让它在 SharePoint 2010 中工作。 我在页面 A 上有一个超链接,它转到页面 B 并传递一个查询字符串值。 我想要的是在页面 B 上创建一个新的超链接,它使用当前的查询字符串值传递给页面 C。这可能吗?我该怎么做呢。

谢谢。

【问题讨论】:

    标签: sharepoint


    【解决方案1】:

    javascript代码:

    document.location = 
        document.location.href.split('?')[0].replace('pageB','pageC') + 
        document.location.href.split('?')[1];
    

    document.location = 
        document.location.host + '/pathToPage/pageC.htm' +                 
        document.search;
    

    【讨论】:

      【解决方案2】:

      您可以使用 ASP.NET 创建动态超链接控件

      例如,您的 URL 中有一个链接参数

      // http://localhost/home.aspx?link=http://www.google.com
      

      然后你请求你的参数

      if (Request.QueryString["link"] != null){    
      string myhyperlink = Request.QueryString["link"];
      

      现在你需要为你的页面添加一个超链接控件

      HyperLink hyp = new HyperLink();
          hyp.ID = "hypABD";
          hyp.NavigateUrl = myhyperlink;
          Page.Controls.Add(hyp);
      

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 2010-12-03
        • 1970-01-01
        • 1970-01-01
        • 2017-05-01
        • 1970-01-01
        • 2023-03-15
        • 1970-01-01
        • 1970-01-01
        • 2019-09-28
        相关资源
        最近更新 更多