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

  • Home
  • SEARCH
  • 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 335111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:07:06+00:00 2026-05-12T10:07:06+00:00

I understand that i cannot do something like List<List<string,string>> . So i have to

  • 0

I understand that i cannot do something like List<List<string,string>>. So i have to put each object in a class, and then have a list of classes.
Below is the problem as I understand it.

  • Class FailedField has properties FieldName, Error
    • sample data: "year", "must be between 1900-2100"
  • Class FailedFields is a list of FailedField; Meaning a list of FailedField per record
    • sample data: { ("year", "must be between 1900-2100"
      ),("percentage", "must be between 0-100")…. }
  • Class FailedFieldsList is a list of FailedFields for multiple records

In case you are wondering why I am trying to implement this data structure, i am collecting validation errors for each failed attempt to insert a record in LINQ-to-SQL.

My code so far:

In the partial class representing one SQL table:

public partial class FailedFields 
{
    public List<FailedField> ListOfFailedFieldsInOneRecord = new List<FailedField>();
    public void addFailedField(FailedField f) 
    {
        ListOfFailedFieldsInOneRecord.Add(f);
    }
    public int getFailedFieldsCount() 
    {
        return ListOfFailedFieldsInOneRecord.Count();
    }
}
public partial class FailedField
{
    public string fieldName;
    public string message;
    public FailedField(string vField, string vMessage)
    {
        this.fieldName = vField;
        this.message = vMessage;
    }
    public override string ToString()
    {
        return fieldName + ", " + message;
    }
}

In the MyDataContext

public partial class MyClassesDataContext
{
  public partial class FailedFieldsList
  {
    private static List<Slab.FailedFields> ErrorList = new List<Slab.FailedFields>();
    public void AddErrorList(Slab.FailedFields errs)
    {
        ErrorList.Add(errs);
    }
    public List<Slab.FailedFields> GetErrorList()
    {
        return ErrorList;
    }
  }
}

And in Codebehind

MyClassesDataContext.FailedFieldsList FailedRecords = new  MyClassesDataContext.FailedFieldsList();
ErrorBoxGridView.DataSource = FailedRecords.GetErrorList();
ErrorBoxGridView.DataBind();

Sample output

|------------------------------------------------------------------------------|
| Record # | Field_1 | Error_1 | Field_2 | Error_2 | ... | Field_10 | Error_10 |
|------------------------------------------------------------------------------|
|   Data   |   Data  |   Data  |   Data  |   Data  | ... |   Data   |   Data   | 
|------------------------------------------------------------------------------|

From Visual Studio debugger, I know I am filling the objects upto the FailedFieldsList class. I am not sure where i am going wrong. Either the logic of the data structure is wrong, or i am not accessing the object correctly. Or maybe List is not the best tool in this case?

If there is something you think would help me understand where i am going wrong, please suggest any reference material you have.

I am stuck. Any help appreciated.

  • 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-12T10:07:06+00:00Added an answer on May 12, 2026 at 10:07 am

    It sounds like you’re trying to bind a list of list of FailedField records to a grid.

    The problem is that the Grid will display what’s in your (first) list, in this case each record in your list is itself a list, so what do you actually want the grid to show?

    You either need to flatten your list of lists down to one list (with something to identify the groups if you like), or you could use a master/detail type of view if there’s info about each list of string pairs you want to display, or you could use a tree to allow drilling down to the level you want.

    Think about what you actually want to display and work backwards from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 215k
  • Answers 215k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Firebug can do this. May 12, 2026 at 10:52 pm
  • Editorial Team
    Editorial Team added an answer Okay, well what I did to fix this was configure… May 12, 2026 at 10:52 pm
  • Editorial Team
    Editorial Team added an answer Yes! If you use the latest WMQ .Net classes and… May 12, 2026 at 10:52 pm

Related Questions

I understand how STI works, in that I have say a Post model that
Update 2009.04.24 The main point of my question is not developer confusion and what
I'm writing a C# routine to call a stored proc. In the parameter list
I barely got into ASP.Net webforms when MVC came out, and now I'm ready

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.