Wednesday, 30 April 2014

Pass Multiple Parameter in DataKey in Gridview

In Aspx Page:
DataKeyNames="QueryNo,QueryYear"

in Vb Page:
Protected Sub GVAllAppointment_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVAllAppointment.RowDataBound

        If e.Row.RowIndex > -1 Then
            Dim QN As String = GVAllAppointment.DataKeys(e.Row.RowIndex).Values("QueryNo").ToString()
            Dim QY As String = GVAllAppointment.DataKeys(e.Row.RowIndex).Values("QueryYear").ToString()

            DirectCast(e.Row.FindControl("lnkViewDetails"), HyperLink).NavigateUrl = "details.aspx?Q=" & QN & "&Y=" & QY
          
        End If

    End Sub

No comments:

Post a Comment