Click here to Skip to main content
15,923,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys

I would like to know what would be the best practice in .net for the following

I currently have a .net application which i am busy with and just would like to know what would be the best practice of handling the data.

Currently on page load i have some data that gets loaded into a datatable which is used as the datasource for a datagrid.

in the grid there is a link which the user clicks which redirects them to a calculation page and once completed on the calculation page, the application redirects to the previous page and i pass the calculation back to the previous page through a datatable in a viewstate.

Is this the best way or is there a better way of handling this?

What I have tried:

currently i pass a session variable which holds a uniqueId for the row being updated, to the calculation page once the calculation is done i have a viewstate which holds a datatable with the uniqueid and update the fields in the datatable and on redirect do a select on the viewstate datatable to see if the data exists for the rowId = uniqueid and update the columns in the datagrid if there is data
Updated 10-Jul-17 20:32pm

1 solution

The solution is fine. Memory managment gets only a problem, when the loaded data gets to big. First hints is: when it gets slower than normal.

If you want to preserve memory than check that you arent copying data around. Compute once and store the results in class data members. Miminize log and debug output.

Consider closing the db-connection after fetching the data. This is good resource managment.
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