Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to add data to a grid nd calculate the netsalary at the end of the coloumn data tat get values from the user at run time in the grid..?
Posted
Comments
Rachna0309 8-Jan-13 6:15am    
You can enter data in grid by enabling columns in grid.Double-click on column and enter data.
Then on cellvaluechnaged event of grid,you can calculate your salary as per your formula.
Dhritirao's 9-Jan-13 1:48am    
u r asking while the data entered in grid it should calculate the net salary
ezhil1825 9-Jan-13 2:16am    
yeah..tatz ryt..
Dhritirao's 9-Jan-13 4:20am    
i dnt knw it is useful to ur code or not but check it

1 solution

C#
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{
TotalPrice += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Total"));
}
if (e.Row.RowType == DataControlRowType.Footer)
{
TextBox lbltotal = (TextBox)e.Row.FindControl("txttotalprice");
lbltotal.Text = TotalPrice.ToString();
}




this code is used to auto generate the sum of the records in total column.
 
Share this answer
 

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