Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

check boxes values saved in session across mutiple pages.

$
0
0
    Public Sub Check_Clicked(sender As Object, e As EventArgs)        Dim data As New List(Of String)        Dim loadnumbers As String = ""        Const comma As Char = (",")        Dim dp As String        dp = Session("data")        Try            If dp IsNot Nothing Then                For Each row As UltraGridRow In iuwgLoadGrid.Rows                    Dim myCellItem = GetGridCell(row, row.Index, "SELECTLOAD")                    Dim myCheckBox = DirectCast(myCellItem.FindControl("chkSelectLoad"), CheckBox)                    If (myCheckBox.Checked = TrueThen                        loadnumbers = loadnumbers & CType(GetGridCell(row, "lgh_number").Value, Integer)                        Dim val As String = Session("data")                        Dim arrVal As String() = val.Split(",")                        For Each s As String In arrVal                            If Not data.Contains(s) Then                                data.Add(s)                            End If                            Session("data") = data                        Next                    End If                Next            Else                For Each row As UltraGridRow In iuwgLoadGrid.Rows                    Dim myCellItem = GetGridCell(row, row.Index, "SELECTLOAD")                    Dim myCheckBox = DirectCast(myCellItem.FindControl("chkSelectLoad"), CheckBox)                    If (myCheckBox.Checked = TrueThen                        loadnumbers = loadnumbers & CType(GetGridCell(row, "lgh_number").Value, Integer) & comma                        Session("data") = loadnumbers                    End If                Next            End If        Catch ex As Exception            Master.ShowMsg(""Message.Type.Error)        End Try    End Sub

So I written this bit of code. It Check the session for checkbox values so see if empty. If empty add the first checkbox value if not empty keep the existing values add new checkbox value. As long as I am on the same page it work perfectly. When I go to the next page  session data is lost 


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>