change of session does not fire button click event for second time

G

Guest

This button click is fired for first time, but does not get fired for second
time if I click. It again fires 3rd time, but not 4th time and so on..
I want to button to be fired everytime.
I want to add new valyes to my Session of ArrayList type when Button is
clicked.

Can anyone help? Please let me know what I am doing wrong. Here is a sample
call:


private void oButton_Click(object sender, System.EventArgs e)
{

if (oPictureKeys.Count > 0) //loaded ArrayList Keys from database
Session["_Session_PictureKey"] = oPictureKeys; //Always have values


if (HttpContext.Current.Session["_Session_PictureKey"] != null)
{
ArrayList oList=null;
string szNewKey = "NewPictureKey"; //New key I want to insert
to Session
oList = (ArrayList)(Session["_Session_PictureKey"]);
oList.Add(szNewKey);
Session["_Session_PictureKey"]=oList;
}
}
 
G

Guest

How can I do that?
Why would the button not fire consistently when session value changes?
Can anyone elaborate on this? Is this a bug?
thanks


Scott Allen said:
Did you verify the behavior with the Visual Studio debugger?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 4 Apr 2005 10:15:05 -0700, "N. Shehzad" <N.
This button click is fired for first time, but does not get fired for second
time if I click. It again fires 3rd time, but not 4th time and so on..
I want to button to be fired everytime.
I want to add new valyes to my Session of ArrayList type when Button is
clicked.

Can anyone help? Please let me know what I am doing wrong. Here is a sample
call:


private void oButton_Click(object sender, System.EventArgs e)
{

if (oPictureKeys.Count > 0) //loaded ArrayList Keys from database
Session["_Session_PictureKey"] = oPictureKeys; //Always have values


if (HttpContext.Current.Session["_Session_PictureKey"] != null)
{
ArrayList oList=null;
string szNewKey = "NewPictureKey"; //New key I want to insert
to Session
oList = (ArrayList)(Session["_Session_PictureKey"]);
oList.Add(szNewKey);
Session["_Session_PictureKey"]=oList;
}
}
 
S

Scott Allen

There is some basic documentation on debugging here:

http://msdn.microsoft.com/library/d...ebug/html/vxtskDebuggingASPWebApplication.asp

Looking at just this section of code impossible to guess what the
problem is. Perhaps oPicutreKeys.Count is 0?

--
Scott
http://www.OdeToCode.com/blogs/scott/


How can I do that?
Why would the button not fire consistently when session value changes?
Can anyone elaborate on this? Is this a bug?
thanks


Scott Allen said:
Did you verify the behavior with the Visual Studio debugger?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 4 Apr 2005 10:15:05 -0700, "N. Shehzad" <N.
This button click is fired for first time, but does not get fired for second
time if I click. It again fires 3rd time, but not 4th time and so on..
I want to button to be fired everytime.
I want to add new valyes to my Session of ArrayList type when Button is
clicked.

Can anyone help? Please let me know what I am doing wrong. Here is a sample
call:


private void oButton_Click(object sender, System.EventArgs e)
{

if (oPictureKeys.Count > 0) //loaded ArrayList Keys from database
Session["_Session_PictureKey"] = oPictureKeys; //Always have values


if (HttpContext.Current.Session["_Session_PictureKey"] != null)
{
ArrayList oList=null;
string szNewKey = "NewPictureKey"; //New key I want to insert
to Session
oList = (ArrayList)(Session["_Session_PictureKey"]);
oList.Add(szNewKey);
Session["_Session_PictureKey"]=oList;
}
}
 

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
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top