且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在datagrid视图中添加超链接

更新时间:2023-12-03 17:19:28

给你gridview添加一个按钮字段列。



To you gridview add a button field column.

<asp:gridview xmlns:asp="#unknown">
     <columns>
          <asp:buttonfield buttontype="Link" text="Edit" commandname="Edit" />
     </columns>
</asp:gridview>





在处理行命令事件后面的代码中。



In the code behind handle the row command event.

Private Sub gridview_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles gridview.RowCommand
    If e.CommandName = "Edit" Then
        Dim iRowIndex As Integer = CInt(e.CommandArgument.ToString())
        Dim iId As Integer = CInt(grdParadeSignUps.DataKeys(CInt(iRowIndex)).Value)
        Response.Redirect("EditRegistration.aspx?ID=" & iId)
    End If
End Sub


点击编辑列选项在'GridView Tasks'中,然后从可用字段中添加'HyperLinkField'并设置其属性
click on the 'Edit Columns' option in 'GridView Tasks' then add a 'HyperLinkField' from the available fields and set its properties