如何在GridView控件LinkBut​​ton控件打开一个新的IE窗口 [英] How to make linkbutton control in gridview open an new ie window

查看:175
本文介绍了如何在GridView控件LinkBut​​ton控件打开一个新的IE窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要

  <asp:TemplateField HeaderText ="ename">
        <ItemTemplate > <asp:Label ID="lbl2" Text ='<%#Eval("ID") %>' runat ="server" >
        </asp:Label>
        </ItemTemplate>
        <EditItemTemplate >
        <asp:TextBox ID ="textbox1" Text='<%#Eval("name")%>'  runat ="server"  ></asp:TextBox>
<asp:LinkButton ID ="link1" Text='<%#Eval("name")%>'  runat ="server"  ></asp:LinkButton>


        </EditItemTemplate>
        </asp:TemplateField>

我在修改的ItemTemplate 的文本和链接按钮
根据条件()

i have an textbox and link button in Edit itemtemplate based on the condition()

如果(文='&LT;%#的eval(ID)%>')

if(Text ='<%#Eval("ID") %>')

ID = 1显示文本

id=1 show textbox[edit item temalpate]

ID = 2显示链接按钮

id=2 show link button[edit item temalpate]

ID = 3显示链接按钮

id=3 show link button[edit item temalpate]

现在链接按钮,我有值 [文字='&LT;%#的eval(name)的%GT;'] (例如:www.stackoverflow.com ,google.com)
因此一个在用户点击链接按钮打开一个新的浏览器窗口,并显示该网站显示在链接按钮的clcik

now in link button i have value [Text='<%#Eval("name")%>'] (eg:www.stackoverflow.com ,google.com) so that one an user clicks on the link button open a new browser window and show that website show to open an new browser window on the clcik of the link button

推荐答案

您可以使用的超链接控制,而不是一个LinkBut​​ton?

Could you use a HyperLink control rather than a LinkButton?

例如

<asp:HyperLink id="hyperlink1" 
              NavigateUrl="<%#Eval('name')%>"
              Text="<%#Eval('name')%>"
              Target="_blank"
              runat="server"/>

这篇关于如何在GridView控件LinkBut​​ton控件打开一个新的IE窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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