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.NullRefe renceException: 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.SelectedIt em.Value.Equals ("") Then
strGetFile = txtSource.Text & "\" &
lst2.SelectedIt em.Value
Cache("strFile" ) = strGetFile
Response.Redire ct("page2.aspx" )
End If
End Sub
The error happens at
If Not txtSource.Text. Equals("") And Not
lst2.SelectedIt em.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 1 1301
OK. I moved the response.Redire ct line in the lst2 event
to a button control. This seems to have fixed the problem
(for now). It appears that all the listbox events were
being called when I clicked on the back button, and also
the page load event of page2.aspx appeared to be getting
called from the lst1 selected... event. Moving ..redirect
to the button resolved that. But I suspect there will be
other not fun things in store with my setup. Any
suggestions welcome if any sees anything whacky here. -----Original Message----- 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.NullRefe renceException: Object reference not set to an instance of an object.
and modified the code where the error was happening.
ThenI 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.SelectedI tem.Value.Equal s("") Then strGetFile = txtSource.Text & "\" & lst2.SelectedI tem.Value Cache("strFile" ) = strGetFile Response.Redire ct("page2.aspx" ) End If End Sub
The error happens at
If Not txtSource.Text. Equals("") And Not lst2.SelectedI tem.Value.Equal s("") Then
What is the correct way to refer to txtSource when it is empty/null?
How can I eliminate the above error?
TIA, Steve . This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt MC |
last post by:
Hello,
Is there anyway to detect when the back button has been pushed? I have
three frames, and it requires three pushes of the back button to get
back to the previous "window". I would like to detect when the user
pushes it and send them back in one go.
thanks,
Matt.
|
by: Peter D. Dunlap |
last post by:
Hello,
I realize that this may not be the best place to ask this question,
through the application is asp.net. I also realize that questions
about disabling the back button are generally met with derision, so
let me explain:
(1) The site is actually a web-based application, not a "web site" per
say, and is not accessable by the public. ...
|
by: szabelin |
last post by:
Hello,
how do I do history back when asp:button is clicked? I
can't use <input button> - I have to use asp:button.
Thanks!
|
by: John |
last post by:
Hi,
I have a web form accounting app. In certain instances it
causes trouble if the user clicks the Back button. I've
read several posts that indicate that it is not
recommended (or even possible) to try to disable the Back
button. So, what I did was save a session variable with
the name of the current webform and then check this...
|
by: Rosanne |
last post by:
Is there a way to clear the SelectedIndex of a listbox when the
browser's back button is clicked?
I have a page that contains a server side list box with AutoPostBack =
True. When the user clicks an item in the listbox, they are redirected
to an information page based on their selection. On this information
page, if the user clicks the...
| |
by: =?Utf-8?B?QWxCcnVBbg==?= |
last post by:
I have a form containing three AJAX UpdatePanels, two of which contain a pair
of listboxes and a pair of buttons, with the third one containing a pair of
radio buttons in a radiobutton list and either three CascadingDropDown lists
or two CascadingDropDown lists and a textbox depending on which radio button
is selected. The only other control...
|
by: bendlam |
last post by:
I have a page that contains search criteria and when you click on the
search button it causes a post back that populates a dataview on the
same page. One of the gridview columns contains a link that navigates
to a details page. When I try to go back to the search results page i
get "Page cannot be displayed" error. How do i go back to the...
|
by: mcl |
last post by:
I have a domain name which is set up for web forwarding with a frame.
I have a link on one of the site's pages to an external site.
When I select the link the external site is displayed correctly with
its own URL in the address bar.
When I select the <backbutton in the browser, my domain name appears
temporarily in the browser, but it...
|
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= |
last post by:
I the page knows there was a cross post back. but i can not find the control.
(asp.net 3.5)
calling page has a master
calling control:
<asp:Button ID="btnSendAlert" runat="server" Text="Go"
onclick="btnSendAlert_Click" PostBackUrl="ItemUpLoadAdmin.aspx"
CommandArgument="5" />
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |