473,408 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

2.0: unexpected modification of a field

Hi,
I wrote a class with a variable which value is modified although
there's no responsible statement, as I see.
Below the code - the class is a user control.

public partial class BooksiDataList : System.Web.UI.UserControl
{
private string ChangedISBN;

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
ChangedISBN = null;
}

protected void BooksList_Edit(object sender, DataListCommandEventArgs
e)
{
ChangedISBN = ((Label)e.Item.FindControl("BooksListISBN")).Text;
// here ChangedISBN != null
}

protected void BooksList_Update(object sender,
DataListCommandEventArgs e)
{
if (ChangedISBN != null) // HERE PROBLEM: ChangedISBN == null
...
ChangedISBN = null;
}

}

BooksList_Update is called always after BooksList_Edit - which sets
'ChangedISBN' to non-empty string. But in BooksList_Update ChangedISBN
is always null.
Could you explain me this phenomena?
Thank you very much
/RAM/
Jun 27 '06 #1
1 1095
Hi,
How can you assure than _Edit is called ALways before _Update ?

Also remember that EACH TIME the page is executed ( by user request, or by
handling an event) the variable is recreated and its value return to null.

Put a breakpoint everywhere the var is used and debug your code.

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"R.A.M." <r_********@poczta.onet.pl> wrote in message
news:4a********************************@4ax.com...
Hi,
I wrote a class with a variable which value is modified although
there's no responsible statement, as I see.
Below the code - the class is a user control.

public partial class BooksiDataList : System.Web.UI.UserControl
{
private string ChangedISBN;

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
ChangedISBN = null;
}

protected void BooksList_Edit(object sender, DataListCommandEventArgs
e)
{
ChangedISBN = ((Label)e.Item.FindControl("BooksListISBN")).Text;
// here ChangedISBN != null
}

protected void BooksList_Update(object sender,
DataListCommandEventArgs e)
{
if (ChangedISBN != null) // HERE PROBLEM: ChangedISBN == null
...
ChangedISBN = null;
}

}

BooksList_Update is called always after BooksList_Edit - which sets
'ChangedISBN' to non-empty string. But in BooksList_Update ChangedISBN
is always null.
Could you explain me this phenomena?
Thank you very much
/RAM/

Jun 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Heinz | last post by:
Hello, I have a project that is used by other project in my solution. This common project is also used by a VB6 application (so it is placed in GAC). Since I did this (this is what I...
7
by: Sven Schwyn | last post by:
Hi Many people are asking how to automatically update columns containing a modification date on updates. I'm wondering if the only solutions in the current pgsql really are... - adding...
1
by: Brian Cobb | last post by:
Greetings; I have an application where I am receiving HTML fragments containing snippets (sub-fragments?) of XML. I wish to extract the XML bits for further processing. In the process of...
6
by: Cro | last post by:
Dear Access Developers, The 'Allow Additions' property of my form is causing unexpected results. I am developing a form that has its 'Default View' property set to 'Continuous Forms' and am...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
9
by: Dave G | last post by:
The unexpected problem is this - say, 2 pcs called A and B, both running my Access program, both arranged in a FE/BE arrangement. There is an unbound form in the program. When the form opens all...
2
by: Simon | last post by:
Dear reader, After modifying a form the following MS Access messages pops up: "The change you requested to the table were not successful because they would create duplicate value in...
7
by: Andrew McLean | last post by:
I have a bunch of csv files that have the following characteristics: - field delimiter is a comma - all fields quoted with double quotes - lines terminated by a *space* followed by a newline ...
3
by: MarcJoseph | last post by:
I have a database that is shared my multiple users who enter and update records on a weekly basis. Is there a way I can add a field to my main data table that will automatically generate the...
8
by: illuzion | last post by:
ok I keep getting this error: Parse error: syntax error, unexpected T_VARIABLE in /home/illuzion/public_html/BAMF/contactus.php on line 38 and this error is possibly on other lines could...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.