Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2006

Tip: Looking for answers? Try searching our database.

Change headertext dynamically populated gridview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sharon - 01 Dec 2006 00:41 GMT
Hello All,

I have a gridview control in webform which is dynamically populated on
page startup with a query. I was trying to change the header text for
the columns and also set wrap to false. i have four columns in
gridview. Any suggestions guys

This is what i used but i keep getting error
Private Sub changestyle()
GridView1.Columns(1).HeaderText = "First Name"
End Sub

Error
Index was out of range. Must be non-negative and less than the size of
the collection.
Parameter name: index
Kevin Frey - 01 Dec 2006 02:15 GMT
What do you mean by "Dynamically Populated". Do you mean the colums are
automatically generated?

Assuming that's the case, you could just manually declare all the columns
for the gridview instead, rather than relying on the Auto Generate
functionality.

Another possibility is to hook a handler onto Pre-Render of GridView, but
I'm not sure if the Columns will have been generated by then, or even if the
auto-generated columns are accessible in that manner.

> Hello All,
>
[quoted text clipped - 12 lines]
> the collection.
> Parameter name: index

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.