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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:43:30+00:00 2026-05-22T22:43:30+00:00

Update1: this is all looks great but there is big problem which i have

  • 0

Update1:

this is all looks great but there is big problem which i have been looking for and so far i havent found that yet. – see my comments in the code.

var custNames = LoadCustNames();
var custFirstInitials = (from cn in custNames
select cn.Name.Substring(0, 1).ToLower()
).Distinct();

    foreach (var item in custFirstInitials)
    {

        bool has = list.Contains(item);  
        //the above line of code return true because its checking whether `list.Contains or item.Contails` this will always return true but what i want is something sequence checking the first loop checks for A (found? true) and second loop checks for B (false) and third loop checks for C (false) .......so that i can generate ahref based on whether its return true or false.

        if (has)
        {
            //generate href
        }
        else
        {
            //disable href
        }
    }

i have updated my question and seems like the question was not clear..

so here you go….
i am trying to compare a string[] myArray with a string and if anything is unmatched then store it in a string.

for an example:

i have a list of custName starting with A, S & Z and compare with myArray

string[] myArray = { "a", "b", "c", "d", "e", "f", "g", .... "z"}; 

public class CustNames
{
    public string Name { get; set; } 
    public CustNames() { }
    public CustNames(string name) 
    { 
       Name = name;
    }
}

public List<CustNames> LoadCustNames()
{
    //connect to db and load the data.
    List<CustNames> names = new List<CustNames>
        {
            new CustNames("Alan"),
            new CustNames("Scoot"),
            new CustNames("Shark"),
            new CustNames("Alpha"),
            new CustNames("Zebra") 
        };
    return names;
}

//page_load event....
   //...check for postback....
    for (int i = 0; i < 5; i++)
    {
        string name = LoadCustNames()[i].Name.ToString(); 
        ListItem(name);
    }

List<char> HeaderOf = new List<char>();
protected void ListItem(string cust)
{
    // need a way to compare with myArray... 

    char CheckMe = cust.Substring(0, 1).ToUpper()[0];
    if (!HeaderOf.Contains(CheckMe))
    {
        HeaderOf.Add(CheckMe);
    }
}
  • 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-22T22:43:31+00:00Added an answer on May 22, 2026 at 10:43 pm

    Disable it but still leave as href (clicking it won’t do anything but would still look like active link)

    b.InnerHtml = "<a onclick='return false;' class='WhateverClassForStyle' href=#" + nextRole.ToUpper().ToString() + ">" + nextRole.ToUpper().ToString() + "</a>";
    

    Don’t display as href

    b.InnerHtml = "<span class='WhateverClassForStyle'>" + nextRole.ToUpper().ToString() + "</span>";
    

    Use css class WhateverClassForStyle to style it the way you want.

    I guess you are trying to get a list of first initials of customer names.

    var custNames = LoadCustNames();
    var custFirstInitials = (from cn in custNames
                                select cn.Name.Substring(0, 1)
                            ).Distinct();
    

    custFirstInitials is now IEnumerable<string> and you can do a loop on it or check against it if the href should be made or not.

    foreach (var letter in myArray)
    {
        if (custFirstInitials.Contains(letter.ToUpper()))
        {
            // Enabled Href
        }
        else
        {
            // Disabled Href
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking at using less . js (looks great), but our site requires that
This is not a unique problem that has not been there in the past,
I have a problem which has been driving me mad for days - I've
Update: This is, as I was told, no principle Python related problem, but seems
Even after all the hotfixes and updates that are supposed to fix this, my
All I want is to update an ListViewItem's text whithout seeing any flickering. This
Update: This does work, I was being stupid :( i have the following extension
UPDATE: This question is out of date, but left for informational purposes. Original Question
Update: This question was an epic failure, but here's the working solution. It's based
Update: This question is a duplicate of Are there any programming languages targeting PHP,

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.