Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6574901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:19:14+00:00 2026-05-25T15:19:14+00:00

Hi all I am having a requirement like selecting multiple values and then to

  • 0

Hi all I am having a requirement like selecting multiple values and then to delete. I will have some list of EMployee IDs along with Dates and PayID values.

I will get all this fields in multiple. Now i would like to add this to dictionary element like for particular EmpID I have to assign Date and PayID as keys.

I thought of writing like this

public struct MyValue
{
    public List<int> lst;
    public List<int> lst1;
    public List<DateTime> lstdt;
}

public class MyDictionary : Dictionary<int, MyValue>
{
    public void Add(int key, List<int> lst1, List<int> lst2, List<DateTime> lstDt1)
    {
        MyValue v1=new MyValue();
        v1.lst = lst1;
        v1.lst1 = lst2;
        v1.lstdt = lstDt1;
        this.Add(key, v1);
    }
}

But I am little bit confused in dealing with this so can any one give me an idea to implement as per my requirement.

This is my requirement if I have EmpID as 1 for this I will have Multiple PayIDs and Dates like 1 and System Date.

Even I will get Mutilple EmpIDs But if exists already in the dictionary as Key element I don’t want to add it again.

(using 2.0 framework)

How can I do this?

Here is what i am doing i will have a grid with check boxes to delete the records. This gridview holds EmpID PayID and Date

Now if a user select some multiple check boxes and tries to delete i would like to store the values to a Dictionary. I will get multiple EmpID from the selection in which the same EmpID may exists for multiple times. So what i need to do is i would like to store the corresponding Values to a Dictionary with EmpID as Key value and the Values to the dictionary as multiple which will be the PayID and Date.

Sample structure of my Gridview

       Chkbox     EmpID    PayID     Date
        chk        123       1     8-31-2011
        chk        123       2     10-31-2011
        chk        1234       1     18-31-2011
        chk        1234       1     19-31-2011

for EmpID 123 i would like to assign 1,2 and the 2 dates as Values

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:19:14+00:00Added an answer on May 25, 2026 at 3:19 pm

    Can any one tell what’s wrong in this

       arrEmpID.Add(1);
        arrEmpID.Add(1);
        arrEmpID.Add(2);
        arrEmpID.Add(2);
    
        arrPay.Add(1);
        arrPay.Add(1);
        arrPay.Add(2);
        arrPay.Add(2);
    
    
        DateTime dt = DateTime.Now;
        DateTime dt1 = DateTime.Now.AddMinutes(1);
        DateTime dt2 = DateTime.Now.AddMinutes(1);
        DateTime dt3 = DateTime.Now.AddMinutes(1);
    
        arrPayID.Add(dt);
        arrPayID.Add(dt1);
        arrPayID.Add(dt2);
        arrPayID.Add(dt3);
    
        EmpIDs = (int[])arrEmpID.ToArray(typeof(int));
        Dates = (DateTime[])arrPayID.ToArray(typeof(DateTime));
        PayIDs = (int[])arrPay.ToArray(typeof(int));
    
    for (int i = 0; i < EmpIDs.Length; i++)
        {
            if (!(d.ContainsKey(EmpIDs[i])))
            {
                List<int> values = new List<int>();
                List<DateTime> ldt = new List<DateTime>();
                d.Add(EmpIDs[i], values, ldt);
            }
            d[EmpIDs[i]].lst.Add(PayIDs[i]);
            d[EmpIDs[i]].lstdt.Add(Dates[i]);
        }
    
       foreach (int EmpID in d.Keys)
        {
            foreach (int pID in d[EmpID].lst) // I just missed out this values
            {
                sb.Append(pID);
                sb.AppendLine(" ");
            }
            foreach (DateTime dtTimes in d[EmpID].lstdt)  // I just missed out this values
            {
    
                sb1.Append(dtTimes.ToString("MMddyyyy"));
                sb1.AppendLine(" ");
            }
        }
    
        Label1.Text = sb.ToString();
        Label2.Text = sb1.ToString();
    

    I have my dictionary as follows

    public struct MyValue
    {
        public List<int> lst;
        public List<DateTime> lstdt;
    }
    
    public class MyDictionary : Dictionary<int, MyValue>
    {
        public void Add(int key, List<int> lst1, List<DateTime> lstDt1)
        {
            MyValue v1 = new MyValue();
            v1.lst = lst1;
            v1.lstdt = lstDt1;
            this.Add(key, v1);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all I am having a requirement where I have to assign multiple keys
I have a requirement to sort some strings that contain data like this: var
Hi i all having a requirement to delete particular data from a text file.
I have a MS-Visual Studio 2005 workspace having all c code. This application(exe) allocates
Hi all I am having some problems that I think can be attributed to
all. I'm having a bit of weird problem with client server program. I have
I have some utility functions like: void myVibratePhone() { AudioServicesPlaySystemSound (kSystemSoundID_Vibrate) ; } that
I have a requirement on my current project (a Flex app which will be
All, I have a requirement to hide my EF implementation behind a Repository. My
I have a dynamic data ASP.NET application with a requirement to give some users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.