Findcontrol in Gridview Footer row not working

K

kevin

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
 
A

Alvin Bruney [MVP]

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
 
K

KevD711

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.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top