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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access to datagrid footer 1

Status
Not open for further replies.

tcstom

Programmer
Aug 22, 2003
235
GB
Anyone know how to gain access to a datagrid's header and footer rows if you're not inside a datagrid item event handler? e.g. I want to bind a datagrid, then later in the code update a value in the footer...
 
You can use the DataGrid's Items property which will return a DataGridItem for each Item (so you can just pass in the index of the relevant Item you want).

Also, if you use the latest version of the framework, there is a FooterRow property for the GridView control.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I'm using ASP.NET 1.1 at the moment. Iterating through DataGrid items only gives me items of type Item or AlternatingItem so neither Header nor Footer...?
 
OK, maybe it isn't stored in the Items collection then (I don't have 1.1 here to test). You could try seeing if they exist in the Control collection e.g.
Code:
myDataGrid.Controls(0).Controls(myDataGrid.Controls(0).Controls.Count - 1)


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Spot on. You can indeed obtain a reference to the footer using that code. Many thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top