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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:09:40+00:00 2026-06-08T22:09:40+00:00

Newbie here so not sure what are the potential performance issues here, and what

  • 0

Newbie here so not sure what are the potential performance issues here, and what are the best practices.

Is this a good idea? Thoughts?

FROM THIS:
(prone to manual error when cells codes are all over the place and/or gridview changes)

row.Cells[1].Visible = false;   // CustomerId
row.Cells[9].Visible = false;   // OrderNumber
row.Cells[10].Visible = false;  // ProductId
. . .
int matchId = row.Cells[11].Text;
. . .

TO THIS:
(more readable and manageable, just make sure the enum is in sync with the gridview)

row.Cells[Col.CustomerId.GetVal()].Visible = false;     
row.Cells[Col.OrderNumber.GetVal()].Visible = false; 
row.Cells[Col.ProductNumber.GetVal()].Visible = false;  
. . .
int matchId = row.Cells[Col.CustomerName.GetVal()].Text;
. . .


public enum Col
{
    MatchId = 1,
. . .
    ServiceCode = 9,
    CustomerId = 10,
    CustomerName = 11,
. . .

}

public static class ColExt
{
    static public int GetVal(this Col col)
    {
        return (int)col;
    }
}
  • 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-08T22:09:43+00:00Added an answer on June 8, 2026 at 10:09 pm

    In my opinion the code is more readable with the enums. But it’s important that you have a code generator for the enum(s). Otherwise you do a lot of misstakes, if you have many columns to handle.

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

Sidebar

Related Questions

Shell newbie here. I'm not sure what I am doing is a good way
(Not sure if this belongs here or on webmasters; please move if necessary.) I'm
I am not sure if this general question is even allowed in here but
Not sure this issue about Qt or C++ in general, I'm just a newbie
This is possibly a newbie question, but I'm not sure what terms to search
Disclaimer: I'm a total newbie at graph theory and I'm not sure if this
Extreme Android developer newbie here...well, new to Android development, not development in general. I
this newbie here is smacking his head with webservices over Rails. Perhaps someone could
Android newbie here. I'm using this tutorial to show some rows that I fetch
I am newbie to ajax here and I know somebody would have encountered this

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.