create gridview rows programmatically

I want to add data to a gridview programmatically by looping through a collection. Something like:

        List<MyClass> object_list = bdb.GetSoundexNames(txtFirstName.Text, txtMiddleName.Text, txtLastName.Text);
        foreach (MyClass obj in object_list)
             // I want to create the columns Firstname, middlename and lastname

Can someone please help me with the syntax?

Should I create the columns programatically too? Or should I just add some html code in the aspx page?
Who is Participating?
I'd highly recommend not doing this...It just is going to make your life much more difficult!

If you can do it in the HTML, do it, if you don't think you can do it, let me know why not and I'll see what I can't tell you so you can do it.
IUAATechAuthor Commented:
I think I can do it in the HTML. Will let u know if I have any trouble.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.