datagridview中的超链接 [英] HyperLink in datagridview

查看:172
本文介绍了datagridview中的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在datagridview中提供超链接,

任何帮助将不胜感激.

How to give hyperlink in datagridview,

any help would be appreciated.

推荐答案

请参考以下主题:
DataGrid中的超链接 [ Gridview链接按钮单击事件 [创建到GridView VB的动态超链接\ ASP.NET [ ASP/VB.NET Gridview动态链接按钮事件处理 [ ^ ]
Please refer following threads:
Hyperlinks in DataGrid[^]
Gridview link button click event[^]
Create Dynamic Hyperlink to GridView VB \ ASP.NET[^]
ASP/VB.NET Gridview dynamic link buttons event handling[^]


我假设您必须使用DataGridViewLinkColumn来显示您的HyperLinks.在这种情况下,为了对HyperLinks上的用户单击做出响应,您必须处理CellContentClick事件.此事件与CellClick和CellMouseClick事件不同,CellClick和CellMouseClick事件在用户单击单元格中的任意位置时发生.

对于asp.net gridview

在gridview中用
I assume you must have used DataGridViewLinkColumn to display your HyperLinks. In that case, in order to repspond to User Clicks on HyperLinks, you must handle the CellContentClick event. This event is distinct from the CellClick and CellMouseClick events, which occur when a user clicks anywhere in a cell.

for asp.net gridview

with in a gridview write like
<asp:gridview id="gvDeleteUsers" runat="server" width="321px" xmlns:asp="#unknown">
 AutoGenerateColumns="False" onrowdeleting="gvDeleteUsers_RowDeleting"
 BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
 CellPadding="4" Font-Names="Verdana" Font-Size="Small">

 <rowstyle backcolor="White" forecolor="#330099" horizontalalign="Center">
 VerticalAlign="Middle" />
 <columns>
  <asp:templatefield headertext="UserName">
 <itemtemplate>
 <asp:linkbutton id="TypenameLabel" runat="server" cssclass="style_homefirst" text="<%# Eval("Text") %>" />
 </itemtemplate>
 <asp:commandfield showdeletebutton="true" />
 </columns>
 <footerstyle backcolor="#FFFFCC" forecolor="#330099" />
 <pagerstyle backcolor="#FFFFCC" forecolor="#330099" horizontalalign="Center" />
 <selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="#663399">
 HorizontalAlign="Center" VerticalAlign="Middle" />
 <headerstyle backcolor="#990000" font-bold="True" forecolor="#FFFFCC" />

 </selectedrowstyle></rowstyle>


在Eval中,输入您要为其创建链接按钮的数据库字段名称.


here in Eval write ur database field name for which u want to create link button.


试试看:
http://www.java2s.com/Tutorial/ASP.NET/0380__Data-Binding/将超链接字段控件添加到GridView.htm [ ^ ]
Try this :
http://www.java2s.com/Tutorial/ASP.NET/0380__Data-Binding/AddingaHyperlinkFieldcontroltotheGridView.htm[^]


这篇关于datagridview中的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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