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 9017229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:12:48+00:00 2026-06-16T04:12:48+00:00

I need to implement this approach – two kinds of data sent as one

  • 0

I need to implement this approach – two kinds of data sent as one set of parameters in a single Type – so that one type will hold those two parameters. That way I will be able to pass that Type to be processed by some method.

the first data item is:

  • Columns to be displayed , named: displayed

the second data item:

  • A copy (or only a portion) of that Columns displayed, as it has the same source, only these columns will not be displayed… in other words, Columns to omit, so I’ve named it: omitted

both are of a type Columns that I named – SelectedColumns

public class SelectedcColoumns
{
    public enum renederingMode
    {
        Displayed,
        omitted
    }
    public class omitted
    {

    }
    public class displayed
    {
    }
}

As the request for that SetOfColumns to be displayed is done by choosing table-name. So the Column class as data to be displayed varies based on the user choice the available source For SelectedColumns to choose from, is as shown below:

public class tableNames
{
   public static readonly string tblCustomers = "tblCustomers";
   public static readonly string tblProducts = "tblProducts";
}

public class TblColumns
{
    public class tblCustomers
    {
        public const string custID = "custID",
                            Name = "Name",
                            Phone = "Phone";
                            Email = "Email";
  
    }
    public class tblProducts 
    {
        public const string PrudctID = "PrudctID ",
                            PrudctName = "PrudctID",
                            PrudctCategory = "PrudctCategory";
    }
    ...etc'

}

When the user selects a set of tables Columns … from any table user could, in this example.. choose either Customers or Products columns (e.g. SelectedColumns – is tblCustomers Columns), I then need to have another list, of those that the user selected to omit (not to display) from all of available table Columns.

Say the user chose to have Table Customers as a table. He chose to omit tblCustomers.custID + tblCustomer.Email because he only needs the name and phone to be displayed.

The problem I’ve encountered is while having these parameters in my reach (table name + columns to omit), How could I send it to process (passing it as One Parameter)? So that is why I’ve created a dedicated class, to hold this Type as sent parameter: all columns + omitted Columns in one piece.

This is where I am currently stuck; I need to know how to use it to build / construct the parameter out of user selection.

public class SelectedColoumns
{
    public enum renederingMode
    {
        Displayed,
        omitted
    }
        public class omitted
        {
           List<string> omitCols_ListStr = new List<string>();
        }
       
        public class displayed
        {
           List<string> dispCols_ListStr = new List<string>();
        }
}

In this part, I retrieve list of Columns through reflection as the supplier of data, via the following method:

Get any Nested Class-Fields, As List<string>, By a nested class-name and it’s parent – Type.

public static List<string> anyNestedClassFiledsAsListByType<ClassToReturnOneOfitsNested_Fields>(string NetedClassName)
 {
                var RetNestedClassFildsListValues = typeof(ClassToReturnOneOFitsNested).GetNestedTypes()
                    .First(t => String.Compare(t.Name, NetedClassName, true) == 0).GetFields(BindingFlags.Public | BindingFlags.Static)
                    .Where(f => f.FieldType == typeof(string)).Select(f => (string)f.GetValue(null)).ToList();
                return RetNestedClassFildsListValues;
            }

so to produce this I could use the method above Like that

var TableColumns_ALL = 
anyNestedClassFldsAsListByType<TblColumns>(tableNames.tblCustomers);

My question is related to the class that needs to send TableColumns_ALL + the selected Columns to omit to be then processed by renderSelectedTable() below.

So it’s even more basic than the complexity of reflection, but still some how i do not know the popper way to construct, the SelectedColumns class, so it will accommodate and format the structure of this new data type that will be sent as a parameter the method is something like this.

public void renderSelectedTable(SelectedColoumns CurrentUserSelectedCols)
{
    StringBuilder NwTRLoopSB = new StringBuilder();

    string curRowStyle= string.Empty,
           nwLine = Environment.NewLine + "\t\t\t",
           BaseTemplateTD = string.Empty;

    NwTRLoopSB.Append(
            string.Format(
                "<table id='tbl_Settings' cellspacing='0' border='1'><tr id='TR_headers'{0}>{1}",
                curRowStyle,
                nwLine
                )._Dhtml_DoubleQoutes()
        );
    foreach (var Item in SelectedListStr.Select((Val, counter) => new { Value = Val, Index = counter }))
    {
            curRowStyle = Lsts.DynamicStyle_Generator(Item.Index);

            if(Lsts.ExcludeColumns(Item.Value, OmittedCols))
            {
                BaseTemplateTD = string.Format("<td>{0}</td>{1}", Item.Value, nwLine)._Dhtml_DoubleQoutes();
                NwTRLoopSB.Append(BaseTemplateTD);
            }    
      
    }///ENd TR cells generator Section

    NwTRLoopSB.Append("</tr></table>");
    return NwTRLoopSB.ToString();

}
  • 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-06-16T04:12:50+00:00Added an answer on June 16, 2026 at 4:12 am

    I would approach it this way:

    public class Column{
        public string Name { get; set; }
        public bool Visible { get; set; }
    }
    
    public class Grid{
        public List<Column> Columns { get; set; }
    }
    

    So the I could easily define my full table with either visible or ommited columns.
    In the OP’s example:

    public class SelectedColumns
    {
        //instead of the enum you would have boolean in the column type "Visible" (whether is shown or not)
        public enum renederingMode
        {
            Displayed,
            omitted
        }
        // instead of both these you would have a List o Column types that have a name AND a boolean, so you have your List<string> and a boolean to indicate whether it is visible or ommited. Well at least that's how I understood it.
        public class ommited
        {
    
        }
        public class displayed
        {
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a question about how to implement the equals method when I need
So, I need some way to implement an undirected network ( I think this
I need to implement an efficient excel-like app. I'm looking for a data structure
There is this DB-connection-like object that my web application will need. It is pretty
I want to know the best way to implement this (approach). I will bee
The problem is that I need to get static data from server prior the
Need some help with this problem in implementing with XSLT, I had already implemented
I need to implement portable code, but I do not know how to deal
I need to implement the following: There is a table A which is supposed
i need to implement the email signature with image.As of now we only support

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.