ok this is not as simple as it sounds i have a gridview in which i am displaying data on labels now i want to show the total of columns in footer i tried to use rowdatabound event of gridview but i am not sure how to approach this one. my query is as follows:
string str = string.Format(@"select m.pcode,sum( m.salary) as SalaryConsumed, y.salary,sum(m.ta) as taConsumed,y.ta,sum(m.contigency) as contiused, y.contigency,sum(m.nrc) as nrcconsumed,y.nrc,sum(m.institcharges) as institgiven,y.institcharges,sum(m.others) as miscused,y.others, m.fyyear,y.yearlyalloc from monthly m
inner join yearly y on m.pcode = y.pcode and m.fyyear = y.fyyear where m.pcode=('" + DropDownList1.SelectedItem.ToString() + "' ) AND m.fyyear=('" + DropDownList2.SelectedItem.ToString() + "')group by m.fyyear, m.pcode, y.salary, y.ta,y.contigency,y.nrc,y.institcharges,y.others,y.yearlyalloc", con);
in gridview rowdatabound event i know this is the code to be used but idont know what to add the label names that i have taken to show the data or the column names
if (e.Row.RowType == DataControlRowType.DataRow)
{
mtot = columns or label? ;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label mtot = (Label)e.Row.FindControl("expenditure");
expenditure.Text = mtot.ToString();
}
http://i45.tinypic.com/4g6exz.jpg[
^]this is the image of my gridview