Another day, another puzzle. This time, binding a multidimensional array to a Data Grid View Control. Ok, so it would be a lot simpler to just bind the data source directly to the control, but in this case I had to make a fair few tricky transformations to the data. Long story short - how do I dump my data into the grid view control at run time? The solution provided here proved perfect.
- So why would you want to get rid of the html hidden viewstate field from your aspx files? My reason was that I was using the gridview control on a page and changing the response.content to excel Response.ContentType = "application/vnd.ms-excel" to act as quick data extract into a spreadsheet - messy but it works, at least it did in classic ASP. Moving to ASP.NET and adding a form and gridview control drops in the __VIEWSTATE form field which then ends up in the first row of the spreadsheet.