Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Should HeaderText change the behavior of a GridView?

Reply
Thread Tools

Should HeaderText change the behavior of a GridView?

 
 
Harry Keck
Guest
Posts: n/a
 
      02-13-2007
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?
 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      02-14-2007
Replied to this at Forums
http://forums.asp.net/thread/1576785.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net


"Harry Keck" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not change Headertext with sorting ability in Griview from code behind Charly ASP .Net 1 02-20-2010 04:46 AM
Should HeaderText change the behavior of a GridView? =?Utf-8?B?SGFycnkgS2Vjaw==?= ASP .Net 1 02-14-2007 02:51 PM
Change headertext dynamically populated gridview Sharon ASP .Net 1 12-01-2006 02:15 AM
Change HeaderText in datagrid Řyvind Isaksen ASP .Net 1 11-06-2005 02:19 PM
change HeaderText of DataGrid in PreRender() Andy Wang ASP .Net 0 05-12-2004 08:56 PM



Advertisments