We help IT Professionals succeed at work.
Get Started

C# Writing a LIST to Datagrid

tmajor99
tmajor99 asked
on
204 Views
Last Modified: 2015-06-18
Is it possible to write a LIST to a datagrid?  I have a LIST that contains a list of attribute names that I want to display in datagrid row. For example sortedList:
attributeTtitle
  Color
  Size
  Length

I want to list this to a datagrid or some type of table so that the is aligned horizontally like this:
Color    Size    Length

Currently, I am writing this LIST to an EXCEL record like beow:
var sortedList = FilteredValueOfProduct.OrderBy(prod => prod.attributeTtitle).ToList();

            foreach (var item in sortedList)
            {
                HttpContext.Current.Response.Write("<Td>");
                //Get column headers  and make it as bold in excel columns
                HttpContext.Current.Response.Write("<B>");
                HttpContext.Current.Response.Write(item.attributeTtitle.ToString());
                HttpContext.Current.Response.Write("</B>");
                HttpContext.Current.Response.Write("</Td>");
            }

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 2 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE