hello, I 'm still a noob at programming in vb.net
I have a little problem. I 'm trying to get my selected rows to another page. I already can select my rows with checkboxes but I don't know how I can pass them through a session to another page.
hopefully someone can help me.

greetz

Recommended Answers

All 9 Replies

Hi there Thunderman and welcome to DaniWeb! Here is a great link where I believe you will find your answer:

Hope that helps you

Hi majestic

I looked at the link you gave me, but they only discuss the way to pass the values through querystrings, but I like to pass my values through sessions, so I don't need to add something extra in my URL

I think the second post on that link is what you need:

Dim gridrow As GridViewRow = GridView1.SelectedRow

Session.Add("Value1", gridrow.Cells(0).Text)

Session.Add("Value2", gridrow.Cells(4).Text)

Response.Redirect("TestPage.aspx")

End Sub

I think the second post on that link is what you need:

Dim gridrow As GridViewRow = GridView1.SelectedRow

Session.Add("Value1", gridrow.Cells(0).Text)

Session.Add("Value2", gridrow.Cells(4).Text)

Response.Redirect("TestPage.aspx")

End Sub

I 've tried your code you gave me, but I don't want to get one value at a time out of my gridview. My problem is, I select multiple rows with my checkbox and I want to get the selected rows in on time and pass them to another page.

hi sir, u had sent the code for sending the values to other form but u didn't mention where to pass these values in gridview form. please help me

I want to past my selected rows from my firstpage.aspx to a secondpage.aspx. I already got the code to put my values in an array and send the array to my secondpage.aspx with an session but I can't get the values out of my array on the secondpage.aspx. I get an error: nullreferenceexception was unhandled by user code.
This is my code I use on my secondpage.aspx to get the values out of my array and try to put them into a table.

'variabelen in tabel inlezen
        Dim hshToestel As Hashtable
        hshToestel = Session("Reservatie")
        For Each oToestel As clstblToestellen In hshToestel
            Dim tr As New TableRow
            tr.Cells.Add(oToestel.fnSelect)
            tblReservatie.Rows.Add(tr)
        Next

hi thunderman,
i think i'm facing the same prob now as u're facing in this. please tell me how to select values from gidview on selection of multiple checkboxes. i want to manipulate multiple values at the same time.

hi u can use row command event to achieve this functionality.
when ever u click on a checkbox,this event gets fired.

hello, I 'm still a noob at programming in vb.net
I have a little problem. I 'm trying to get my selected rows to another page. I already can select my rows with checkboxes but I don't know how I can pass them through a session to another page.
hopefully someone can help me.

greetz

Protected Sub GridView1_SelectedIndexChanging
        GridView1.SelectedIndex = e.NewSelectedIndex
        Dim SelIndDt As Integer = GridView1.PageIndex * GridView1.PageSize
        SelIndDt = SelIndDt + e.NewSelectedIndex
        Dim Key = CType(GridView1.Rows(e.NewSelectedIndex).FindControl("lbl_IT_CodeNo"), Label).Text 'Gridview Selected CodeNo

        Dim drow As DataRow = ds.Tables("tItMst").Rows.Find(Key)
        Dim ChkTF As CheckBox = CType(GridView1.Rows(e.NewSelectedIndex).FindControl("CheckBox1"), CheckBox)
        If ChkTF.Checked = True Then
            ChkTF.Checked = False
            drow("SelChkBox") = 0
            ArList.Remove(drow("CodeNo").ToString)
        Else
            ChkTF.Checked = True
            drow("SelChkBox") = 1
            ArList.Add(drow("CodeNo"))
        End If
        Session("sesArList") = ArList
        ds.GetChanges(DataRowState.Modified)
        Session("da1") = da
        Session("ds1") = ds
        datafetch()

    End Sub
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.