2014年7月13日 星期日

[RESOLVED] performing calculation on gridview data


HI, I am developing a mis for vehicle management system. where driver will fill the details in a form and will be save in the database. Now at manager mis, manager will see the data based on vehicleID and time duration (lets say of last 1 month). There is
also a Analytics button which can be used to display the vehicle statistics, means total distance covered by vehicle in specified duration, total fuel cost etc.


Now since the data is based on parameters vehicle id and duration. What is the proper way to perform calculations. Do i have to use temporary table to keep the filtered data and perform calculation on it.


Thanks



Depending on the amount of calculations, you could just do the calculations in the GridViews RowDataBound event and then display the results.



hi,


use gridview row databound event for row data calculation.





paindaasp


you could just do the calculations in the GridViews RowDataBound event and then display the results.


The calculations has to be done outside gridview and the results will be shown in a seperate panel.. Suppose, for the total distance covered by a vehicle, i need to subtract the initial reading of the first entry from the final reading of the last entry.
And i guess rowdatabound is for specific row. Is it possible this type of calculation through rowdatabound. If yes, can u plz ellaborate.


Thanks



In this case, I would say that the RowDataBound event is not the best place to to this.  I would put a button outside the GridView to call a routine to make your calculations.





paindaasp


I would put a button outside the GridView to call a routine to make your calculations.


Yes the same thing i did, and it works so easily, direct calculation from gridview, no database access required, Thanks


沒有留言:

張貼留言