Findcontrol in Gridview Footer row not working

Discussion in 'ASP .Net' started by kevin@webpageconcepts.com, Apr 24, 2007.

  1. Guest

    Hi. I'm ripping my hair out.

    I'm in VS 2005 Framework 2. I have one website with a gridview with
    some template fields. I'm using the footer row to insert records. For
    this discussion there is a textbox and a linkbutton in the footer row.
    In the click event of the linkbutton an example of what I'm doing is
    this:

    Dim txt as textbox =
    GridView1.FooterRow.Cells(0).FindControl("TextBox1")
    then for fun simply:

    response.write txt.text

    In Website A this works NO PROBLEM and writes out whatever I put in
    the textbox after hitting the linkbutton.

    I created another website/project and set up the same scenario but I
    can't for the life of me get the flipping thing to write out.

    Everything is EXACTLY the same. I don't even get the stupid "Object
    reference not set to an instance of an object" error. the page just
    posts back and does nothing. I can force the error by changing the
    FindControl id. ex. findcontrol("textbox1thisiskillingme")

    I tried using the RAW control ID but no dice:
    Findcontrol("GridView_ctl0_TextBox1")

    All on the same server, same root directory, same everything as far as
    I can tell.
    Any thoughts? Thank you much, KD
    , Apr 24, 2007
    #1
    1. Advertising

  2. I swear i saw this post before did i?
    why don't you just go to the cell in question in one of the events and do a
    control[0] and cast as a text box. This will always work.

    --
    Regards,
    Alvin Bruney
    ------------------------------------------------------
    Shameless author plug
    Excel Services for .NET is coming...
    OWC Black book on Amazon and
    www.lulu.com/owc
    Professional VSTO 2005 - Wrox/Wiley


    <> wrote in message
    news:...
    > Hi. I'm ripping my hair out.
    >
    > I'm in VS 2005 Framework 2. I have one website with a gridview with
    > some template fields. I'm using the footer row to insert records. For
    > this discussion there is a textbox and a linkbutton in the footer row.
    > In the click event of the linkbutton an example of what I'm doing is
    > this:
    >
    > Dim txt as textbox =
    > GridView1.FooterRow.Cells(0).FindControl("TextBox1")
    > then for fun simply:
    >
    > response.write txt.text
    >
    > In Website A this works NO PROBLEM and writes out whatever I put in
    > the textbox after hitting the linkbutton.
    >
    > I created another website/project and set up the same scenario but I
    > can't for the life of me get the flipping thing to write out.
    >
    > Everything is EXACTLY the same. I don't even get the stupid "Object
    > reference not set to an instance of an object" error. the page just
    > posts back and does nothing. I can force the error by changing the
    > FindControl id. ex. findcontrol("textbox1thisiskillingme")
    >
    > I tried using the RAW control ID but no dice:
    > Findcontrol("GridView_ctl0_TextBox1")
    >
    > All on the same server, same root directory, same everything as far as
    > I can tell.
    > Any thoughts? Thank you much, KD
    >
    Alvin Bruney [MVP], Apr 25, 2007
    #2
    1. Advertising

  3. KevD711 Guest

    Thanks, strange things happened with this post. oh well

    Turns out I was re-binding the grid on every postback, I fixed that
    and it worked as it should. I'm going to try your suggestion for fun
    though. Thanks.
    KevD711, Apr 26, 2007
    #3
    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,059
  2. Ruby

    findcontrol in datagrid footer

    Ruby, Jan 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,811
  3. K B
    Replies:
    2
    Views:
    5,071
    otkoth
    Sep 17, 2007
  4. Andrew Robinson

    FindControl in GridView Footer

    Andrew Robinson, Apr 24, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    1,010
    Andrew Robinson
    Apr 25, 2007
  5. Replies:
    0
    Views:
    153
Loading...

Share This Page