1

Just trying a simple bind. No values are populated into the GridView however.

 protected void Page_Load(object sender, EventArgs e)
    {
        List<string> list = new List<string>();
        list.Add("Bread");
        list.Add("Cheeze");
        list.Add("Wine");
        list.Add("Beer");
        list.Add("Waffles");

        GridView1.DataSource = list;
        GridView1.DataBind();
    }

2 Answers 2

2

Did you set AutoGenerateColumns to true?

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" />
Sign up to request clarification or add additional context in comments.

1 Comment

haha I noticed it was preset to false. Then it occurred to me that I need to generate my own columns.
0

another approach

protected void Page_Load(object sender, EventArgs e)
    {
        List<string> list = new List<string>();
        list.Add("Bread");
        list.Add("Cheeze");
        list.Add("Wine");
        list.Add("Beer");
        list.Add("Waffles");

        GridView1.DataSource = list;
        GridView1.DataBind();


        GridView1.Columns.Add(new BoundField());
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.