Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   change of session does not fire button click event for second time (http://www.velocityreviews.com/forums/t99885-change-of-session-does-not-fire-button-click-event-for-second-time.html)

=?Utf-8?B?Ti4gU2hlaHphZA==?= 04-04-2005 05:15 PM

change of session does not fire button click event for second time
 
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;
}
}

Scott Allen 04-04-2005 10:23 PM

Re: change of session does not fire button click event for second time
 
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.
Shehzad@discussions.microsoft.com> wrote:

>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;
> }
>}



=?Utf-8?B?Ti4gU2hlaHphZA==?= 04-05-2005 04:05 PM

Re: change of session does not fire button click event for second
 
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" wrote:

> 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.
> Shehzad@discussions.microsoft.com> wrote:
>
> >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;
> > }
> >}

>
>


Scott Allen 04-05-2005 08:06 PM

Re: change of session does not fire button click event for second
 
There is some basic documentation on debugging here:

http://msdn.microsoft.com/library/de...pplication.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/


On Tue, 5 Apr 2005 09:05:08 -0700, "N. Shehzad"
<NShehzad@discussions.microsoft.com> wrote:

>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" wrote:
>
>> 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.
>> Shehzad@discussions.microsoft.com> wrote:
>>
>> >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;
>> > }
>> >}

>>
>>




All times are GMT. The time now is 10:49 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.