?
Solved

asp.net for loop alphabets

Posted on 2010-09-17
2
Medium Priority
?
452 Views
Last Modified: 2012-05-10
I have nested for loop in asp.net C# page

I want each item in the first for loop to be A ,B,C,D,E...
and the items in inside loop to be 1.1,1.2,1.3... in A
2.1,2.2,2.3.. in B

A.test
1.1
1.2
1.3
B mytest
2.1
2.2
2.3
C gtest
3.1.
3.2
3.3
3.4
.
.
.
.
and so on
Any help appreciated
0
Comment
Question by:Angela4eva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
kris_per earned 2000 total points
ID: 33705019

Something like this? Hope it gives you the idea to suit yours...


            for (char alpha = 'A'; alpha <= 'Z'; alpha++)
            {
                Console.WriteLine(alpha);

                int sectionNum = alpha - 'A' + 1;

                // the criteria for the second part of num is not mentioned in your question
                // it is taken as 4 for all sections
                for (int subSectionNum = 1; subSectionNum <= 4; subSectionNum++)
                {
                    Console.WriteLine(sectionNum + "." + subSectionNum);
                }
            }

            // Output of this will be:
            A
            1.1
            1.2
            1.3
            1.4
            B
            2.1
            2.2
            2.3
            2.4
            ...
            till Z

Open in new window

0
 

Author Closing Comment

by:Angela4eva
ID: 33718452
great. thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question