Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Findcontrol in Gridview Footer row not working

Reply
Thread Tools

Findcontrol in Gridview Footer row not working

 
 
kevin@webpageconcepts.com
Guest
Posts: n/a
 
      04-24-2007
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

 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      04-24-2007
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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> 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
>



 
Reply With Quote
 
 
 
 
KevD711
Guest
Posts: n/a
 
      04-26-2007
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing Hope! FindControl of dynamic gridview not working K B ASP .Net 2 09-17-2007 12:27 AM
FindControl in GridView Footer Andrew Robinson ASP .Net 1 04-24-2007 11:12 PM
Gridview row databound event - can't get past the 1st row of gridview maurban@gmail.com ASP .Net 5 10-13-2006 09:37 PM
GridView nested in DataList - refreshing corresponding DataList row after updating GridView row H5N1 ASP .Net 0 04-26-2006 11:41 PM
findcontrol not getting reference to controls in datagrid footer james_crane@btinternet.com ASP .Net Web Controls 0 01-17-2005 02:26 PM



Advertisments