Assigning DataTable to ViewState is a good way?
问题 I'm getting a DataTable from a DataBase and assigning to ViewState like below: Because I don't want to hit the database for every time. DataTable dt = GetDataTable(); ViewState["dtTable"] = dt; GetDataTable() is a method, which retrieves 1000 records from the DataBase. Is this the best way or which one is the best way to handle this? 回答1: First things first: Explanations aside, It still depends a lot on your requirements, environments settings ... The viewstate is stored in a hidden field