I'm trying to create a session for a selected id from a grid view. the problem is I keep getting all the values but i want only on selected value to be passed. any idea how to do that?
this is the first page code:
Private Sub BindGrid()
Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("dbconnection").ConnectionString)
con.Open()
Dim cmd As New SqlCommand("select distinct Name,assignment_id, Description ,cod from assignments
INNER Join crmsLecturerXCrsSection ON crmsLecturerXCrsSection.emp_key = assignments.emp_key
INNER Join CRMSStudentsXCrsSection ON CRMSStudentsXCrsSection.CrsSec_id = crmsLecturerXCrsSection.CrsSec_id
INNER JOIN CRMS_CourseXSection ON CRMS_CourseXSection.CrsSec_id = CRMSStudentsXCrsSection.CrsSec_id
INNER JOIN CRMSECTIONS ON CRMSECTIONS.SEC_ID = CRMS_CourseXSection.SEC_ID
left JOIN crmscourses ON crmscourses.crs_id = CRMS_CourseXSection.crs_id
INNER JOIN CRMS_CourseXSection cs ON CRMS_CourseXSection.SEC_ID = CRMSECTIONS.SEC_ID
INNER JOIN CRMSSEMESTER ON CRMSSEMESTER.SEM_ID = CRMS_CourseXSection.SEM_ID
where CRMSSEMESTER.SEM_ID='1'
and crmsLecturerXCrsSection.emp_key='436' and crmscourses.crs_desc='" + Session("crs") + "'", con)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
Dim listIDs As New List(Of String)
Dim row As DataRow
For Each row In dt.Rows
listIDs.Add(row("assignment_id").ToString())
Next
Session("assid") = listIDs
this is the second page where i try to display the value in a label:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim assignments = TryCast(CObj(Session("assid")), List(Of String))
Label4.Text = (assignments)
End Sub


