2.0: unexpected modification of a field of user control

R

R.A.M.

Hello,
I wrote a class with private 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 BooksiList_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'. But in BooksList_Update ChangedISBN is null.
Could you explain me this phenomena?
Thank you very much
/RAM/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top