Hi All,
I am stucked at one point in one of my web based application; this application is like a HR questionnare and evaluates the employees.
I am populating a gridview with the following code in VB.NET
Dim SQL As String = "Select App_EmpCode, App_EmpName, App_EmpDesig, App_EmpDept, App_EMManager,App_EmpManager, App_EMDGM, App_DGM, App_Supervisor, App_Tag from employee Where App_EmpDept = " & "'" & lblDeptName.Text & "'"
Dim objConn As New OleDbConnection(conStr)
Dim objCom As New OleDbCommand(SQL, objConn)
Dim dr As OleDbDataReader
objConn.Open()
dr = objCom.ExecuteReader
Try
Dim conn As New OleDb.OleDbConnection
conn = New OleDbConnection(conStr)
Dim cmd As New OleDbCommand
cmd = New OleDbCommand(SQL, conn)
Dim da As New OleDb.OleDbDataAdapter
da = New OleDb.OleDbDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds, "Employee")
GridView1.DataSource = ds
GridView1.DataBind()
Catch ex As Exception
Label4.Text = Err.Description
End Try
Till this point everything is working fine; Now I want to make the first column that is employee code as a link. As soon as I click on it; the website redirect me to next page.
I already tried the below option as well but it didnt work:
'Label4.Text = GridView1.DataKeys(GridView1.SelectedIndex).Values("App_EmpCode").ToString()
'Label4.Text = GridView1.SelectedDataKey.Values("App_EmpCode").ToString
'Label4.Text=((Label)GridView1.Rows[0].FindControl("App_EmpCode")).Text
Anyone's comments or help is welcome....
Thanks & Regards,
Waqas