S
Steve
Hello,
In my first (of 2) aspx page I have 2 listboxes. I
populate the first listbox in the PageLoad event
If Not IsPostBack Then
....
When I select an item from the first listbox, lst1, the
2nd listbox gets populated and writes some text to a
hidden textbox called txtSource. Then I redirect to
page2.aspx on the selectedItem event of lst2 and pass the
selections to the next page using Cache("var1") (by the
way, which is better between passing data -- using cache,
session or response.Form?). But back to the problem,
when I click on the back button of the browser from
page2.aspx I was getting this error:
Exception Details: System.NullReferenceException: Object
reference not set to an instance of an object.
and modified the code where the error was happening. Then
I could get back to page1.aspx, but when I click on the
first listbox, lst1, I get the same error as above. Here
is the code snipet where the error happens
Sub lst2_Selected...
Dim strGetFile As String
If Not txtSource.Text.Equals("") And Not
lst2.SelectedItem.Value.Equals("") Then
strGetFile = txtSource.Text & "\" &
lst2.SelectedItem.Value
Cache("strFile") = strGetFile
Response.Redirect("page2.aspx")
End If
End Sub
The error happens at
If Not txtSource.Text.Equals("") And Not
lst2.SelectedItem.Value.Equals("") Then
What is the correct way to refer to txtSource when it is
empty/null?
How can I eliminate the above error?
TIA,
Steve
In my first (of 2) aspx page I have 2 listboxes. I
populate the first listbox in the PageLoad event
If Not IsPostBack Then
....
When I select an item from the first listbox, lst1, the
2nd listbox gets populated and writes some text to a
hidden textbox called txtSource. Then I redirect to
page2.aspx on the selectedItem event of lst2 and pass the
selections to the next page using Cache("var1") (by the
way, which is better between passing data -- using cache,
session or response.Form?). But back to the problem,
when I click on the back button of the browser from
page2.aspx I was getting this error:
Exception Details: System.NullReferenceException: Object
reference not set to an instance of an object.
and modified the code where the error was happening. Then
I could get back to page1.aspx, but when I click on the
first listbox, lst1, I get the same error as above. Here
is the code snipet where the error happens
Sub lst2_Selected...
Dim strGetFile As String
If Not txtSource.Text.Equals("") And Not
lst2.SelectedItem.Value.Equals("") Then
strGetFile = txtSource.Text & "\" &
lst2.SelectedItem.Value
Cache("strFile") = strGetFile
Response.Redirect("page2.aspx")
End If
End Sub
The error happens at
If Not txtSource.Text.Equals("") And Not
lst2.SelectedItem.Value.Equals("") Then
What is the correct way to refer to txtSource when it is
empty/null?
How can I eliminate the above error?
TIA,
Steve