链接按钮属性在新标签中打开? [英] link button property to open in new tab?
问题描述
在我的应用程序有一些链接按钮那里,但是当我右键单击它们,我不能(他们是在禁止模式)找到菜单项打开新的标签页
或在新窗口打开
。
我如何显示这些菜单项?
code例如:
< ASP:LinkButton的ID =lbnkVidTtile1=服务器的CssClass =bodyText的文本='<%#的eval(newvideotitle)%>' />
从<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.aspx\">docs:
使用LinkButton控件创建网页上的超链接样式的按钮。 LinkButton控件,外观与HyperLink控件相同,但具有相同的功能Button控件。如果你要链接到在单击控件时,另一个网页,请考虑使用超链接控制。
块引用>由于这是不实际的标准意义上进行链接,还有对控制没有
目标
属性(在超链接
控制确实有一个目标
) - 这是尝试执行回发从一个文本链接服务器根据你正在尝试做的,你既可以:
- 使用一个
超链接
控制,并设置目标
属性- 提供的<一的方法href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.onclientclick.aspx\"><$c$c>OnClientClick$c$c>打开一个新的窗口,以正确的位置属性。
- 在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
orOpen 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 (theHyperLink
control does have aTarget
) - 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:
- Use a
HyperLink
control, and set theTarget
property- Provide a method to the
OnClientClick
property that opens a new window to the correct place.- In your code that handles the PostBack add some JavaScript to fire on PageLoad that will open a new window correct place.
这篇关于链接按钮属性在新标签中打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!