链接按钮属性在新标签中打开? [英] link button property to open in new tab?

查看:125
本文介绍了链接按钮属性在新标签中打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序有一些链接按钮那里,但是当我右键单击它们,我不能(他们是在禁止模式)找到菜单项打开新的标签页在新窗口打开

我如何显示这些菜单项?

code例如:

 < ASP:LinkBut​​ton的ID =lbnkVidTtile1=服务器的CssClass =bodyText的文本='<%#的eval(newvideotitle)%>' />


解决方案

从<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.aspx\">docs:


  

使用LinkBut​​ton控件创建网页上的超链接样式的按钮。 LinkBut​​ton控件,外观与HyperLink控件相同,但具有相同的功能Button控件。如果你要链接到在单击控件时,另一个网页,请考虑使用超链接控制。


由于这是不实际的标准意义上进行链接,还有对控制没有目标属性(在超链接控制确实有一个目标) - 这是尝试执行回发从一个文本链接服务器

根据你正在尝试做的,你既可以:


  1. 使用一个超链接控制,并设置目标属性

  2. 提供的<一的方法href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.onclientclick.aspx\"><$c$c>OnClientClick打开一个新的窗口,以正确的位置属性。

  3. 在code处理回发添加一些JavaScript火上pageLoad的,这将打开一个新窗口正确的位​​置。

In my application I have some link buttons there but when I right click on them I cannot (they are in disable mode) find the menu items Open in new tab or Open in new window.

How do I show those menu items?

Code example:

<asp:LinkButton id="lbnkVidTtile1" runat="Server" CssClass="bodytext" Text='<%#Eval("newvideotitle") %>'  />

解决方案

From the docs:

Use the LinkButton control to create a hyperlink-style button on the Web page. The LinkButton control has the same appearance as a HyperLink control, but has the same functionality as a Button control. If you want to link to another Web page when the control is clicked, consider using the HyperLink control.

As this isn't actually performing a link in the standard sense, there's no Target property on the control (the HyperLink control does have a Target) - it's attempting to perform a PostBack to the server from a text link.

Depending on what you are trying to do you could either:

  1. Use a HyperLink control, and set the Target property
  2. Provide a method to the OnClientClick property that opens a new window to the correct place.
  3. In your code that handles the PostBack add some JavaScript to fire on PageLoad that will open a new window correct place.

这篇关于链接按钮属性在新标签中打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆