Showing posts with label SPGridView. Show all posts
Showing posts with label SPGridView. Show all posts

Saturday, June 14, 2014

SPGridView error: Value cannot be null. Parameter name:propName

While working with SharePoint grid view to show data, I got an error saying that “Value cannot be null. Parameter name:prop name as shown the image below.



I have checked the properties assigned to SPGridview. By default SPGrid will have option to group the result based on a column. By setting AllowGrouping is “true” we can group the data. We have to specify the grouping column name, Group collapse and Group field display name as shown the code below.

SPGridView.AllowGrouping=true;
SpGridView. GroupField=”Group Field Name”;
SPGridView.AllowGroupCollapse = false;
SPGridView.GroupDescriptionField = “Group Description Name”;
SPGridView.GroupFieldDisplayName = “DisplayName Text

We have to set GroupField, AllGroupCollapse, GroupDescriptionField and GroupFieldDisplayName along with AllwGrouping field to fix the error.

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.