How to display a list of items in 3 columns.

Dear experts,

I have a ms sql table with 2 columns. One is CourseNumber. The other column is StudentName. I would like to search by course number and display the results in 3 columns. There are about 35 students in each course and it would be easier to see the list if it wasn't just a long string of names down a single column.

Can you tell me what control to use and which properties I would use to make it into 3 columns?

Thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
bobbellowsAuthor Commented:
I looked into the examples you gave. The thing is I only have one category to list (students) that I want to break into 3 columns so the list wouldn't string down the whole page.
Fernando SotoRetiredCommented:
Hi Bob;

How do you retrieve the data from the database?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

bobbellowsAuthor Commented:
I missed the notification of your comment so I thought no one was going to be able to help me on this.

I use SqlDataSource control to use a simple stored procedure look up the students that are in the db.
Fernando SotoRetiredCommented:
Can you post the Stored Procedure so I can see what columns are coming back to the caller?
bobbellowsAuthor Commented:
This is the sp:
      -- Add the parameters for the stored procedure here
      @ClassScheduleRecordId nvarchar (15)

      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.

    -- Insert statements for procedure here
SELECT        dbo.Students.StudentWholeName
FROM            dbo.Students INNER JOIN
                         dbo.StudentsAssignedToCourse ON dbo.Students.StudentId = dbo.StudentsAssignedToCourse.StudentId
WHERE        (dbo.StudentsAssignedToCourse.ClassScheduleRecordId = @ClassScheduleRecordId)
ORDER BY dbo.Students.StudentLastName, dbo.Students.StudentFirstName

The only column I'm calling back is the list of students name. I just want the list to wrap into 3 columns so it won't string down the page. I'm just not sure what control to use and how to set it up to list the students in three columns.
Fernando SotoRetiredCommented:
So you are getting back only one column, correct? If correct you want this one column to be divided in to three column? If so can you post the data you are getting back so we can instruct you how to do this.
bobbellowsAuthor Commented:
There is no data yet. Teachers will start using the app in the Fall. They will be entering their students into the db at that time.   What I was thinking was to use the SqlDataSource controller that is calling the sp and bind it to a list box. you are correct. It just returns the list of names that are in their class.
Fernando SotoRetiredCommented:
Hi bobbellows;

I guess I'm a little confused your initial question was, "Can you tell me what control to use and which properties I would use to make it into 3 columns?", are you planning to add more columns to the table and return them? If so you need to tell us what you will have so we can tell you what you need to do.
bobbellowsAuthor Commented:
I'm sorry for the confusion. I'm not talking about columns in a database sense. I'm talking about columns in a display/layout sense. The sp will always return only one list of names (approx. 35 names). I would like to display that list in 3 columns on the layout so the teacher can easily see all the students in the class without having to scroll down the page or in some type of control.
Fernando SotoRetiredCommented:
OK now I understand. Now I need to know how you want to display the name. One control for example a TextBox with the names concatenated three names per row. A DataGridView with three columns per row. What control do you what to display it in?
bobbellowsAuthor Commented:
Whatever would be the most simple and least demanding on the server.
Fernando SotoRetiredCommented:
In order to post a solution can you post the code you are using to call into the database also showing how you are retrieving the column of names with the SP seeming there is more then one way to do this.
bobbellowsAuthor Commented:
I'm simply using SqlDataSource controller that calls the sp I gave you above. Here's the HTML code that calls the sp and returns the list of names.

      <asp:SqlDataSource ID="sdsSelectStudentsByPeriod" runat="server" ConnectionString="<%$ ConnectionStrings:XXXX %>" SelectCommand="uspSelectStudentsXXXXXX" SelectCommandType="StoredProcedure">
              <asp:ControlParameter ControlID="ddlSelectCurrentCourse" Name="ClassScheduleRecordId" PropertyName="SelectedValue" Type="String" />
bobbellowsAuthor Commented:
Ok. I finally found a solution on my own. Displayed the list on a datalist with 3 columns. Don't know if it's the most efficient method but it works.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobbellowsAuthor Commented:
Fernando Soto provided no solution. Just kept asking questions. I tried to answer the best I could. No solution -- no points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.