Showing posts with label custom webpart. Show all posts
Showing posts with label custom webpart. Show all posts

Wednesday, June 4, 2014

SPGrid Error in SharePoint 2010: System.ArgumentNullException: Value cannot be null. Parameter name: container

While working with SharePoint 2010 Grid view grouping depending on dropdown value, got an error saying that “Value cannot be null. Parameter name: Container” as shown the image below.
















Iam unable to find the issue while debugging the code. I have spent much time on this issue finally got the reason. By making “EnableViewState” to false error got fixed as show the code below.

grdPropertyValues.EnableViewState = false;
grdPropertyValues.AllowSorting = true;
grdPropertyValues.AllowGrouping = true;
grdPropertyValues.AllowGroupCollapse = true;



Here grdPropertyValues is SPGridview object. Hope this helps.