473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Findcontrol in Gridview Footer row not working

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 '07 #1
2 13043
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
<ke***@webpageconcepts.comwrote in message
news:11*********************@r30g2000prh.googlegro 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

Apr 24 '07 #2
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.

Apr 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: K B | last post by:
PLEASE be patient and read this. I believe I've actually reached the end of the Web trying to find the answer! I have an aspx using a MasterPage with a ContentPlaceholder. I have a datatable...
13
by: AG | last post by:
I have a gridview that I bind to a List(of Type) at runtime. Not using a datasource control. The gridview has a template column with an imagebutton whose commandname is set to 'Delete'. The...
11
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I am trying to get the text of an item in a GridView, but am doing something wrong. Can someone help me with the correct C# statement I need? Below is my GridView and my attempt to get the control....
1
by: Andrew Robinson | last post by:
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) {...
2
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent...
5
by: bbawa1 | last post by:
I have a GetData methd which is returning a table using
0
by: gnewsgroup | last post by:
Well, I am trying to use the footer row of a GridView for insertion purpose. There are some articles about this, for example, the gridviewguy.com has an example, which always displays the footer...
1
by: naasirsom | last post by:
Dear sir, I am using Gridview asp.net 2.0, I have a problem with Gridview Footer Template. I have put Button, Textbox and RequiredValidator in the Footer Template and Want to validate...
12
by: btreddy | last post by:
Hii Experts, im facing a problem with the javascript validation.i've a gridview in my web form and added a footer tempalte and placed textboxes in tht tempalte ,just to add a new row to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.