asp.net – 链接按钮属性在新选项卡中打开?

前端之家收集整理的这篇文章主要介绍了asp.net – 链接按钮属性在新选项卡中打开?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在我的应用程序中,我有一些链接按钮,但是当我右键单击它们时,我无法(它们处于禁用模式),查找菜单项在新选项卡中打开或在新窗口中打开.

如何显示这些菜单项?

代码示例:

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

解决方法

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.

由于这并不是在标准意义上实际上执行链接,控件上没有Target属性(HyperLink控件确实有一个Target) – 它试图通过文本链接对服务器执行PostBack.

根据你想要做的,你可以:

>使用HyperLink控件,并设置Target属性
>为OnClientClick property提供一个方法,打开一个新窗口到正确的地方.>在处理PostBack的代码中,添加一些JavaScript将在PageLoad上启动,这将打开一个新窗口正确的位置.

原文链接:https://www.f2er.com/aspnet/249860.html

猜你在找的asp.Net相关文章