FindControl in GridView Footer

A

Andrew Robinson

I am using the following code to preload a few controls in the FooterRow
within a GridView control:

protected void Page_Load(object sender, EventArgs e) {
((TextBox)GriwViewRates.FooterRow.FindControl("TextBoxRateInsert")).Text
= "60";
}

The successfully loads the Footer / TextBox on page load but fails to load
the Footer / TextBox when the GridView is Paged. The line still executes
without exception (so it is finding the control) but the value seems to be
lost. Is there something going on with paging that I am missing here? My
TextBox is being over written by something?


Thanks,


Andy
 
A

Andrew Robinson

Found the answer to this shortly after posting. The following fixes the
missing data on paging.

Never mind.

protected void GridViewRates_RowDataBound(object sender,
GridViewRowEventArgs e) {
if (e.Row.RowType == DataControlRowType.Footer) {
((TextBox)e.Row.FindControl("TextBoxRateInsert")).Text = "60";
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top