Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 7th, 2007, 09:10 PM
Authorized User
 
Join Date: Oct 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Table Column Headers

Hi All ASP.Net Guru,

Im trying to display the records of a dynamic table using datagrid and would like to change its column headers. The Caption property of data column doesnt work however. I understand that in order for the Caption property to work, AutoGenerageColumns property must be set to false. I cannot do this however, because my table is dynamic. Is there a way to change the headers of a dynamic table?

Thank you in advance!

 
Old May 8th, 2007, 02:42 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can use the ItemDataBound event, an e.g. as below:

if (e.Item.ItemType == ListItemType.Header)
            {
                e.Item.Cells[0].Text = "New Header";
            }

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old May 8th, 2007, 04:52 AM
Authorized User
 
Join Date: Oct 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks so much Mike! It works! ;)







Similar Threads
Thread Thread Starter Forum Replies Last Post
Column Headers for Dynamic Table elygp ASP.NET 1.0 and 1.1 Basics 1 May 8th, 2007 02:43 AM
Dynamic table column sizing tomsi BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 February 1st, 2006 08:58 AM
Sort column in dynamic table Dreamweaver MX frodedahl Dreamweaver (all versions) 1 September 23rd, 2005 02:59 AM
How to NOT print crosstab column headers chan Crystal Reports 0 August 11th, 2005 05:29 AM
.NET DataGrid Column Headers ashley_y General .NET 1 October 25th, 2004 03:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.