rudolphgatt wrote:
DataSet object to the viewstate
Not a good practise as DataSet's can be huge and storing them in ViewState might affect performance.
rudolphgatt wrote:
Can you change a ViewState object on postback
Yes
rudolphgatt wrote:
How?
What you have done in btnSave looks fine. ViewState will get updated as that line gets executed.
rudolphgatt wrote:
the DataSet object that is returning is the original DataSet and not the 'newDataSet'.
Looks like you missed using
IsPostback
property of the page.
Do something like:
protected void Page_Load(object sender, EventArgs e)
{
string path = "...";
if(!IsPostback)
{
DataSet ds = XmlOperations.GetXmlFile(path);
ViewState["DataSet"] = ds;
}
}
Currently, the Viewstate is updated at every page load. You might just want that to happen for the first time when page loads.