Accessing the value of the GridView footer row is pretty easy

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

 

Print | posted @ Tuesday, October 11, 2005 11:38 PM

Twitter