Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2005, 12:42 PM
Authorized User
 
Join Date: Aug 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP.NET Doesn't Work Right??

I'm finding that variables I set remain even after I refresh the page.

An example is, I accidentally left a DataReader open, then diplayed the page.
Next, I had the user go back to the server, which runs the Page_Load proc again and try to open a new DataReader.
An error said that a data reader for that connection was already open.
The connection and the DataReader should have been closed because the variables should have been 'un' instantiated. NO?

Also, I had a protected bool FoundOnrBranches which I set as true on a TextChanged event:

<asp:textbox class="formTextBox" id="onrName" runat="server" MaxLength="75" Size="50" AutoPostBack="True"></asp:textbox>
-- Server Code --
private void onrName_TextChanged(object sender, System.EventArgs e)
        {
            if(onrName.Text != "")
            {
                GetBranches();
            }
        }
------------------------
GetBranches() Sets the variable FoundOnrBranches to true.
Then I diplay the page and in inline code I reset it to false.
FoundOnrBranches = false;
I stepped through the code and verified that it was false.

Next I (the user) set another field:
<asp:textbox size="50" AutoPostBack="True" class="formTextBox" id="Addr1" MaxLength="100" runat="server"></asp:textbox>
----- Server Code ----
private void Addr1_TextChanged(object sender, System.EventArgs e)
        {
            if(Addr1.Text != "")
            {
                GetComparableProjects();
            }
        }
---------------------------------------

When I step through the code at this point, on Page_Load, I verified that the variable FoundOnrBranches = false.

BUT - when I SINGLE step (3 steps total) to the Addr1_TextChanged event proc the variable has been reset to true.

I step through it one line at a time.
There is NO CODE that resets it to true.

This only happens if I had set it to true in GetBranches() (above).
The application seems to REMEMBER that it was set to true and even though I manually reset it to false, it automatically resets it to true.

What's Going On?


__________________
http://www.softlinksys.com
Professional Software Developer since 1994.





Similar Threads
Thread Thread Starter Forum Replies Last Post
will flash work in master pages of asp.net kalyan141142 ASP.NET 2.0 Professional 2 November 21st, 2007 11:21 AM
javaScript function in asp.net not work in firefox rsanuj ASP.NET 1.x and 2.0 Application Design 1 February 8th, 2007 11:37 AM
ASP.NET Configuration Wizard - How does it work? VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 March 10th, 2006 07:32 PM
How do I make this C# code work in ASP.NET? aowen355 ASP.NET 1.x and 2.0 Application Design 1 July 19th, 2005 01:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.