Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change HeaderText GridView

Status
Not open for further replies.

dcampo

Programmer
Jun 13, 2006
71
EC
hi

Sorry, I don't write very well the English

I have a GridView in my web form, but I want to change the HeaderText in runtime.

I was looking an Internet and I find the property RowHeaderColumn

How I use this property?

Help me!!!
 
You can have it in this way...For this example I am assuming c#, a SQL DataSource from Pubs.Authors.

In .aspx make Gridview - AutoGenerateColumns="false"
In .aspx.cs - Page_Load
Code:
BoundField col1 = new BoundField();
col1.HeaderText = "AuthorId";
col1.DataField = "au_id";
BoundField col2 = new BoundField();
col2.HeaderText = "First Name";
col2.DataField = "au_fname";
BoundField col3 = new BoundField();
col3.HeaderText = "City";
col3.DataField = "city";

Gridview1.Columns.Add(col1);
Gridview1.Columns.Add(col2);
Gridview1.Columns.Add(col3);
/code]

Sharing the best from my side...

--Prashant--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top