I am trying to bind data coming from a GridView into a variable. I only need one item "EmployeeID" from the table. This variable will be set to a guid type and passed to a global class file for use in other pages. I am new to NET so I am not sure how to do this. This is for a class project itself. Here is the code I have so far ..not even sure this is right but when a user selects employee, it is supposed to redirect to another page and pass the variable EmployeeID as a guid to the global class for use in the new page and elsewhere. The code I have now is definately not correct but it is what I was playing with to accomplish this task.

Your help is greatly appreciated as I move in the NET world slowly but surely.

Ted M.

Protected Sub GridView1_RowCommand1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand

        If (e.CommandName = "SelectEmployee") Then
            ' Retrieve the row index stored in the CommandArgument property.
            Dim index As Integer = Convert.ToInt32(e.CommandArgument)
            ' Retrieve the row that contains the button 
            ' from the Rows collection.
            Dim row As GridViewRow = GridView1.Rows(index)

            ' Determine the index of the selected row.
            Dim index1 As Integer = GridView1.SelectedIndex

            ' Display the primary key value of the selected row.

            Dim EmployeeID As Guid = GridView1.DataKeys(row.RowIndex).Value
            'EmployeeID = GridView1.DataKeys(index).Value.ToString()

       Response.Redirect("~/admin/employees.aspx")
 
        End If

    End Sub

Hi,

I didnt get you completely but as far i understand you .It can be achieved by using a session and storing the employee guid ,so that it can be used in other pages.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.