0

I have a GridView with rows and lines. In lines i've put names (e.g. John, Jack, Paul,...) and in the rows the statistics (e.g work hours, salary, status,...). I don't know how to set an hyperlink on the name in order to open a page with the entire profile of the person selected. I want to click on Paul and be redirected to another page with the entire profile plus the photo and other info. Each name must have a different hyperlink. I tried to do it through Access directly but didn't work.

Thank You

Richard

MrKinisia
  • 35
  • 5
  • It might help if you provide the markup for your GridView. Please update your question with that info. Also, why did you tag this as `ms-access`? This appears to be unrelated. – mason Apr 22 '14 at 15:46

1 Answers1

1

you should use this line of code in the gridview.Add the hyperlink in gridview and edit this code to make it functioning. <asp:hyperlinkfield text="Name?" datanavigateurlfields="Id" datanavigateurlformatstring="~\Persondetails.aspx?id={0}" //passing the Id to new page
headertext="Name" target="_blank" />

at the second page you should write the code like this to make sure display the selected nama display all detail in second page.

 Dim nameID As String
    nameID = Request.QueryString("id")
    Dim nameqstring As Integer = Convert.ToInt32(nameID)

to display data from selected second page use this one

 Using sqlComm As New MySqlCommand()
            sqlComm.Connection = sqlConn
            With sqlComm
                .CommandText = "select * From table where NameId=@nameId"
                .Parameters.AddWithValue("@nameId", nameID)
                Try
                    Dim sqlReader As MySqlDataReader = sqlComm.ExecuteReader()
                    While sqlReader.Read()
                        Label1.Text = sqlReader("Name").ToString()
                        Label2.Text = sqlReader("Job").ToString()
                        Label3.Text = sqlReader("Salary").ToString()
                        Label4.Text = sqlReader("Workhours").ToString()
                        Label5.Text = sqlReader("Status").ToString()
End While End Using End Using

hope this can help you alot.

kolapopo
  • 108
  • 1
  • 4
  • 14