Ruminator
Ruminator

Reputation: 164

Gridview thinks it has only one column but I can seem more

I have a stored proc that returns 6 columns.

I have it set as the datasource for my GridView.

I have an automatically generated Select button.

I only see the select button and two columns

In the SelectedIndexChanged event, I only show 1 column:

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        int 
            iCols = GridView1.Columns.Count;
        Console.WriteLine(iCols);
    }

The gridview is not null as I'm showing one row.

Upvotes: 1

Views: 315

Answers (1)

Ruminator
Ruminator

Reputation: 164

I turned to Dino Esposito's book, "Programming Microsoft ASP.NET 4 and saw that auto-generated columns are always "zero" columns. Since I auto-generated a select button, that made one column. I instead used manually produced fields. Problem solved.

Upvotes: 1

Related Questions