Click here to Skip to main content
15,936,171 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to add a data to a single cell in footer. how to bind that data plz help me.



C#
SqlDataAdapter add = new SqlDataAdapter("select sum(Total) from tblQuotationreg",con);
              DataTable dt = new DataTable();
              add.Fill(dt);
              GridView1.DataSource = dt;
              GridView1.Columns[6].FooterText.DataBind();



this is the code i tried im having 6 columns and footer in my gidview i want to add the total and display it in my footer particularly in my column 6.




This is the error occur while running the above code::

'string' does not contain a definition for 'DataBind' and no extension method 'DataBind' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
Posted
Updated 24-Mar-12 0:34am
v2

1 solution

hi , 
use this it will help .

XML
<FooterTemplate>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</FooterTemplate>

C#
Label lb = ((Label)GridView1.FooterRow.FindControl("Label2")); ;
lb.Text = "123";
 
Share this answer
 
Comments
Mohamed Mitwalli 24-Mar-12 11:40am    
did it help you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900