Geeks With Blogs
AzamSharp Some day I will know everything. I hope that day never comes.

No more looping through all the rows and finding which one is the footer row. ASP.NET 2.0 GridView control contains the property FooterRow which returns the footer row. Check out the following code where I get the value out of the TextBox which are in the footer row of the GridView control.

 string firstName = string.Empty;
        
string lastName = String.Empty; 
        
        
// Gets the footer row directly Cool right! 
        
GridViewRow row = GridView1.FooterRow; 
   
        firstName = ((TextBox)row.FindControl("TextBox1")).Text;
        lastName = ((TextBox)row.FindControl("TextBox2")).Text; 
 

        Response.Write("FirstName: " + firstName);
        Response.Write("LastName: " + lastName); 

 

powered by IMHO

 

Posted on Tuesday, October 11, 2005 11:38 PM | Back to top


Comments on this post: Accessing the value of the GridView footer row is pretty easy

# re: Accessing the value of the GridView footer row is pretty easy
Requesting Gravatar...
I'm trying to figure out how to loop through the FooterRow controls and set properties on any textbox controls that are found. Any ideas on this?
Left by Jeremy Wadsworth on Feb 27, 2006 8:22 AM

# re: Accessing the value of the GridView footer row is pretty easy
Requesting Gravatar...
i tryin on tat as wel

i wonder if asp.net allow things like link + 1 which is link1 which is the id of the control

thing will be much simple :D
Left by Lu5ck on Sep 24, 2006 8:45 PM

# re: Accessing the value of the GridView footer row is pretty easy
Requesting Gravatar...
string str = row.FindControl("$100.00")).Text;
it throws an exception because of $ symbol

could any one help me to solve thi sprob
Left by Avinash Pohane on Jun 30, 2007 4:28 AM

# re: Accessing the value of the GridView footer row is pretty easy
Requesting Gravatar...

On Grid_rowDataBound

if (e.Row.RowType == DataControlRowType.Footer)
{
((Label)e.Row.FindControl("lblInstallTotal")).Text = Install.ToString();
((Label)e.Row.FindControl("lblMonthlyTotal")).Text = Monthly.ToString();
((Label)e.Row.FindControl("lblWarrantyTotal")).Text = Warranty.ToString();
}

This sets the value to the Footer Controls
Left by Moncy Samuel on Nov 28, 2007 5:14 AM

# re: Accessing the value of the GridView footer row is pretty easy
Requesting Gravatar...
Hey,

i want functionality for biding a control in footer. Is it possible?

if no then how to assign value to the footer control. I tried with above sol'n but not working yet.

please give me an idea how to do this coding....

Thanks in advance...
------Sagar.
Left by Sagar T on Dec 12, 2007 9:28 PM

# re: Accessing the value of the GridView footer row is pretty easy
Requesting Gravatar...
Thanks for this. I spent about 4 hours trying to find a way
Left by Roy on Feb 20, 2008 8:09 AM

Your comment:
 (will show your gravatar)


Copyright © Mohammad Azam | Powered by: GeeksWithBlogs.net