hello, I 'm still a noob at programming in vb.net

I have a problem. I 'm trying to get my selected rows values to another page. Basically, there two values that not being displayed in the gridview, but is part of the selected statement in the store procedure that populated the gridview. I need to pass these values to another page which then use them to call a store procedure, but I don't know how I can do it I would like to pass them through a session to another page.


hopefully someone can help me.
Thank you in advance for your help.

do you have your fields you want passed as datakeys in the grid?

No, but if it need to be then I can add them.

<asp:GridView ID="grdEmpList" runat="server" AllowPaging="true" PagerStyle-HorizontalAlign="center"
 DataSourceid="dSource"
   DataKeyNames="Field1,Field2.."
Private Sub grdEmpList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdEmpList.SelectedIndexChanged
            Dim i As Integer
            'get row index
            i = grdEmpList.SelectedIndex
            Dim strField1 As String
            RecId = grdEmpList.DataKeys(i).Value
            Response.Redirect("DetailsPage.aspx?Field1=" & strField1..)

if you want it through session, i think you'd just do ..

Session("field1") = strfield1

Thank you Oreo1982. I'll try it.

Oreo1982 or any can help me.

I am not able to pass the two values to the DetailsPage. The page loaded but no data.
"http://localhost:2182/WebSite1/Default2.aspx?person_id=practice_id%="
Below is my codes:

Dim i As Integer
Dim RecId
'get row index
i = gvPatientsCharts.SelectedIndex
Dim strperson_id, strpractice_id As String
RecId = gvPatientsCharts.DataKeys(i).Value
Response.Redirect("Default2.aspx?person_id=" & strperson_id & "practice_id =" & strpractice_id)


Thanks

Dim strperson_id, strpractice_id As String
RecId = gvPatientsCharts.DataKeys(i).Value
Response.Redirect("Default2.aspx?person_id=" & strperson_id & "practice_id =" & strpractice_id)


Thanks

try taking the space out from behind practice_id. & "practice_id=" &

try taking the space out from behind practice_id. & "practice_id=" &

Also... you need an ampersand in the string between variables.


"detailspage.aspx?var1=" & value & "&practice_id=" & value2

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.