【问题标题】:Hyperlink (with query string) open new window specific size超链接(带有查询字符串)打开新窗口特定大小
【发布时间】:2014-02-19 17:21:27
【问题描述】:

我有从查询字符串填充的 GridView2。这是通过单击 GridView1 中的超链接来完成的。这一切都完美无缺,但我希望窗口具有特定大小,而不是在新标签中。我怎样才能做到这一点?

这是我在 GridView1 中的代码:

<asp:TemplateField HeaderText="DateHL">
     <ItemTemplate>
         <asp:HyperLink ID="hl1" runat="server" Target="_blank" NavigateUrl='<%# Eval("DateFormat", "~/DateProfile.aspx?sdate={0}") %>'><%# Eval("DateFormat")%></asp:HyperLink>
     </ItemTemplate>
</asp:TemplateField>  

【问题讨论】:

    标签: javascript asp.net gridview hyperlink


    【解决方案1】:

    您是否尝试过在超链接的 onclientclick 事件中调用 window.open 而不是使用 navigateURL?您可能也应该尝试命名窗口。

    window.open method quick reference

    【讨论】:

      【解决方案2】:

      NavigateUrl 或事件中使用javascript:window.open()

      例如:

      NavigateUrl='<%# string.Format("javascript:window.open('~/DateProfile.aspx?sdate={0}', 'MsgWindow','width=200,height=100')", Eval("DateFormat")) %>'
      

      您可以尝试以下OnClick

      OnClick='<%# Eval("DateFormat", "javascript:window.open('~/DateProfile.aspx?sdate={0}', 'MsgWindow','width=200,height=100')") %>'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-04-12
        • 2011-01-10
        • 2011-06-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多