FindControl in GridView Footer

Discussion in 'ASP .Net' started by Andrew Robinson, Apr 24, 2007.

  1. 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
     
    Andrew Robinson, Apr 24, 2007
    #1
    1. Advertising

  2. 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";
    }
    }


    "Andrew Robinson" <> wrote in message
    news:%...
    >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
     
    Andrew Robinson, Apr 25, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave

    Datagrid FindControl in Footer

    Dave, Nov 14, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,094
  2. Ruby

    findcontrol in datagrid footer

    Ruby, Jan 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,830
  3. Replies:
    2
    Views:
    3,120
    KevD711
    Apr 26, 2007
  4. tropico

    FindControl in Footer Template

    tropico, Nov 6, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    164
    tropico
    Nov 6, 2003
  5. Replies:
    0
    Views:
    174
Loading...

Share This Page