Should HeaderText change the behavior of a GridView?

G

Guest

I have a GridView control with a few columns declared directly in the aspx
file. I have found that if I remove the HeaderText property from all columns
that the GridView handles state completely differently than if any of the
columns has a value set for HeaderText. This sounds completely wrong to me.
Has anyone ever heard of this?

When no columns have a HeaderText, the GridView maintains columns similarly
to the old DataGrid. If I want to dynamically change the columns, I have to
do it after every postback, or else the grid reverts back to the way it was
originally declared in the designer.

When at least one column does have a HeaderText, I can change the columns in
the collection at any point and they will get retained across postbacks.
However, if I change the columns collection at any point, all of my
TemplateFields decalared in the designer get blanked out and render as empty.

Why does HeaderText have such a drastic affect on my GridView, and how can I
have columns with a HeaderText and not have my TemplateFields get emptied?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top