R
rn5a
A ASPX Form has a TextBox & a Button. Users enter their username in
the TextBox & submit the Form after which records pertaining to the
username get retrieved from a MS-Access database table & displayed in
a DataGrid. The DataGrid also provides pagination.
Sub Page_Load(......)
If Not(Page.IsPostBack) Then
'do something
Else
Dim strSQL As String
Dim strUserName As String
strUserName = txtUserName.Text
Session("UserName") = strUserName
Response.Write("UserName: " & Session("UserName"))
strSQL = "SELECT............WHERE UserName = '" &
Session("UserName") & "'"
'some more code comes here
End If
End Sub
Assume that I enter the username Ronnie in the TextBox & submit the
Form. The DataGrid correctly displays the 1st set of records (note
that the records are paginated) but strangely when I click any of the
paging links (or for that matter, any link that re-posts the Form),
the variable Session("UserName") becomes empty! It no longer holds the
username; it gets lost! I have turned on EnableSessionState in the
Page directive as well but that doesn't make any difference.
Can someone please give me some clues on what could be causing this? I
also tried using ViewState("UserName") instead of Session("UserName")
but that doesn't resolve the issue.
the TextBox & submit the Form after which records pertaining to the
username get retrieved from a MS-Access database table & displayed in
a DataGrid. The DataGrid also provides pagination.
Sub Page_Load(......)
If Not(Page.IsPostBack) Then
'do something
Else
Dim strSQL As String
Dim strUserName As String
strUserName = txtUserName.Text
Session("UserName") = strUserName
Response.Write("UserName: " & Session("UserName"))
strSQL = "SELECT............WHERE UserName = '" &
Session("UserName") & "'"
'some more code comes here
End If
End Sub
Assume that I enter the username Ronnie in the TextBox & submit the
Form. The DataGrid correctly displays the 1st set of records (note
that the records are paginated) but strangely when I click any of the
paging links (or for that matter, any link that re-posts the Form),
the variable Session("UserName") becomes empty! It no longer holds the
username; it gets lost! I have turned on EnableSessionState in the
Page directive as well but that doesn't make any difference.
Can someone please give me some clues on what could be causing this? I
also tried using ViewState("UserName") instead of Session("UserName")
but that doesn't resolve the issue.