Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 July 18th, 2007, 01:32 PM
Authorized User
 
Join Date: Jul 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

I've added more breakpoints and continue to test. I am noticing that the 'actv_dt' in my tempList is being overlayed. The zero index record in the tempList should have the '05/01/2007' date, but whenever a record with a new date comes along, all of the records in the tempList get that new date. Strangely, no other fields are overlayed. What could cause something like that? It's probably something real simple, but this is turning into a real head scratcher!

Richard Lelle
Austin, Tx USA
 
Old July 18th, 2007, 01:45 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you post the code for the private fields and public properties of your class? I may have an idea.....

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 18th, 2007, 02:11 PM
Authorized User
 
Join Date: Jul 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I take it you mean the BO class?

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using GVCAPS.DAL;
using GVCAPS.BLL;

namespace GVCAPS.BO
{

    public class ParticipationActivity
    {
        #region Private Vaiables

        private int prtptActvId = -1;
        private static DateTime actvDt = DateTime.MinValue;
        private int actvId = -1;
        private string actvTypeCd = string.Empty;
        private string empId = string.Empty;
        private DateTime logUpdtDttm = actvDt;
        private int logUpdtrId = -1;
        private string actvDscr = string.Empty;

        private ParticipationActivityList participationActivities = new ParticipationActivityList();

        #endregion


        #region Public Properties

        public DateTime actv_dt
        {
            get
            {
                //throw new System.NotImplementedException();
                return actvDt;
            }
            set
            {
                actvDt = value;
            }
        }

        public int actv_id
        {
            get
            {
                //throw new System.NotImplementedException();
                return actvId;
            }
            set
            {
                actvId = value;
            }
        }

        public string actv_type_cd
        {
            get
            {
                //throw new System.NotImplementedException();
                return actvTypeCd;
            }
            set
            {
                actvTypeCd = value;
            }
        }

        public string emp_id
        {
            get
            {
                //throw new System.NotImplementedException();
                return empId;
            }
            set
            {
                empId = value;
            }
        }

        public DateTime log_updt_dttm
        {
            get
            {
                //throw new System.NotImplementedException();
                return logUpdtDttm;
            }
            set
            {
                logUpdtDttm = value;
            }
        }

        public int log_updtr_id
        {
            get
            {
                //throw new System.NotImplementedException();
                return logUpdtrId;
            }
            set
            {
                logUpdtrId = value;
            }
        }

        public int prtpt_actv_id
        {
            get
            {
                //throw new System.NotImplementedException();
                return prtptActvId;
            }
            set
            {
                prtptActvId = value;
            }
        }

        public string actv_dscr
        {
            get
            {
                //throw new System.NotImplementedException();
                return actvDscr;
            }
            set
            {
                actvDscr = value;
            }
        }
        #endregion
    }
}

Richard Lelle
Austin, Tx USA
 
Old July 18th, 2007, 02:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, exactly what I meant, and *exactly* what I was expecting. Take a look at this:

private static DateTime actvDt = DateTime.MinValue;

You declare the field actvDt as static. In contrast to instance fields, static fields apply to the entire class, and not to an instance of that class. Change a static field in one instance, and all the other instances reflect that change.

Simply remove the static keyword from the field declaration and you're good to go.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 18th, 2007, 02:42 PM
Authorized User
 
Join Date: Jul 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

THAT WAS IT!!!! I don't know what posessed me into declaring that variable as static. Now I can FINALLY move on and finish developing my portion of this app.

Imar, thank you very much for your help and patients.

Richard Lelle
Austin, Tx USA
 
Old July 18th, 2007, 02:53 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, you can't have my patients, but other than that, you're more than welcome.... ;)

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
repeating data ph0neman Classic ASP Basics 5 January 18th, 2008 12:34 PM
Data Binding - Editing GridView Row Data desk_star BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 7 December 30th, 2007 11:07 AM
repeater repeating in horizontal (data in 2 colums gbianchi ASP.NET 2.0 Professional 0 April 11th, 2007 11:08 AM
Get data From GridView whitewolf5 ASP.NET 2.0 Basics 0 September 1st, 2006 08:19 AM
Dynamic data in Gridview lukemack ASP.NET 2.0 Basics 8 May 26th, 2006 03:37 PM





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