【问题标题】:How to Pass Hidden field value in HyperLink control in navigateURL attibute?如何在导航 URL 属性中传递 HyperLink 控件中的隐藏字段值?
【发布时间】:2013-04-08 20:51:53
【问题描述】:

谁能告诉我如何通过超链接控件在查询字符串中传递任何隐藏的字段值。请看下面代码中的问题:

<asp:HyperLink ID="hlnkComment" runat="server" 
    onclick="return GB_show('Comment', this.href, 500, 650)" 
    ImageUrl="~/Images/Resources/forum.png" ToolTip="Comment" Text="Comment" 
    NavigateUrl="~/Recruiter/ViewForumComment.aspx?Id=<% hdnReqId.Value %>&Type=R">
</asp:HyperLink>

【问题讨论】:

  • 你能多描述一下你到底想要什么吗?

标签: c# asp.net


【解决方案1】:

查询字符串对用户可见。你可以使用URL ReWriting

或者

只需将它们作为会话对象传递

【讨论】:

    【解决方案2】:

    jquery 会为之做事。在您的 js 方法中重定向代码,例如:

     function GB_show(Comment, url, t1, t2) {
                ////YourCode
                location.href = url + "&q=" + $("#hdnValue").val();
                return false;
            }
    

    【讨论】:

      【解决方案3】:

      使用这个:

      <asp:HyperLink ID="hlnkComment" runat="server" onclick="return GB_show('Comment', this.href, 500, 650);" ImageUrl="~/Images/1.jpg" ToolTip="Comment" Text="Comment" ></asp:HyperLink>
      

      页面加载写入:

      url = string.Format("~/Recruiter/ViewForumComment.aspx?Id={0}&Type=R", hdnReqId.Value);
      hlnkComment.NavigateUrl = url;
      

      【讨论】:

      • 谢谢老兄..我认为它很有用
      猜你喜欢
      • 1970-01-01
      • 2012-05-14
      • 1970-01-01
      • 1970-01-01
      • 2013-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-15
      相关资源
      最近更新 更多