473,785 Members | 3,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FindControl in GridView Footer

I am using the following code to preload a few controls in the FooterRow
within a GridView control:

protected void Page_Load(objec t sender, EventArgs e) {
((TextBox)GriwV iewRates.Footer Row.FindControl ("TextBoxRateIn sert")).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

Apr 24 '07 #1
1 7971
Found the answer to this shortly after posting. The following fixes the
missing data on paging.

Never mind.

protected void GridViewRates_R owDataBound(obj ect sender,
GridViewRowEven tArgs e) {
if (e.Row.RowType == DataControlRowT ype.Footer) {
((TextBox)e.Row .FindControl("T extBoxRateInser t")).Text = "60";
}
}
"Andrew Robinson" <ne****@nospam. nospamwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I am using the following code to preload a few controls in the FooterRow
within a GridView control:

protected void Page_Load(objec t sender, EventArgs e) {

((TextBox)GriwV iewRates.Footer Row.FindControl ("TextBoxRateIn sert")).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
Apr 24 '07 #2

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

Similar topics

0
1534
by: jimmy6509 | last post by:
Hello all, asp.net 2.0, VB. Have a simple question that I hope someone can help me with. gridview -> queries for a filtered recordset, example purchase orders attributed to a specific customer. have figured out how to total in the gridview footer.
1
4898
by: Hennie | last post by:
I have a textbox in the Footer of a Gridview. When I run an insert command I get the following error: " Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an...
2
13069
by: kevin | last post by:
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")
0
2717
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 row. I would like to display the footer row, only when a LinkButton "Add New" is clicked. And after the new record is saved to the database, let the footer row disappear. In the LinkButton's click event handler, I simply say:
1
2216
by: r786amesh | last post by:
Hello Everybody, My question is I want to display Nested gridview footer total by using javascript. its very urgent pls help me... thnx ramesh
1
1152
by: seanwalsh | last post by:
Hi I have a footer row in a gridview that allows inserting of records into a table. One of the controls is a DropDownList control. I want this control to default to the value in the QueryString. So I have this code: protected void Page_Load(object sender, EventArgs e) { DropDownList MenuInsert = gridviewPages.FooterRow.FindControl("MenuInsert") as DropDownList; MenuInsert.SelectedValue =...
1
1665
by: Michael | last post by:
I reviewed a couple of tutorials that show how to display totals in the footer of a gridview. My footer shows up blank. Can someone help me. The code is as follows: <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
0
1379
by: Bogdan | last post by:
Hi, I need to modify gridview footer so it consists only of a single column that spans all data columns in a gridview. I first tried DataBound() event (as per suggestion found on the Net) but that did not always work. That is, the initial gridview display was fine but after selecting a row the footer's column count was 'restored' to the gridview's column count. I then tried RowCreated event and it seems to work. Is this a good place...
1
5180
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 the textbox if it is empty and I used ValidationGroup . I have done all jobs and the page is working but the problem is the button is working the first time but the second time does not postback.
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.