I am using XamWebGrid 10.3. I have code that use to hide some data from the grid, the reason this is done is that we have custom code to pull specialized sum data from the database. I am using the CellControlAttached event to hide the row based on criteria, which is if it GrandTotalInd. When the page load initially it works, but if I change parameters it will give me an error, which I detail below.
{
e.Cell.Row.Height =
new RowHeight(0);
}
however I get an error when having this code Value cannot be infinite or NaN. below you will find the full error:
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Tue, 17 May 2011 06:46:25 UTC
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentException: Value cannot be infinite or NaN.
Parameter name: System.Windows.CustomDependencyProperty
at System.Windows.Controls.Primitives.RangeBase.OnMaximumPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
at System.Windows.DependencyObject.SetValue(DependencyProperty property, Double d)
at Infragistics.Controls.Grids.Primitives.RowsPanel.UpdateScrollInfo(Int32 totalRowCount)
at Infragistics.Controls.Grids.Primitives.RowsPanel.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
Line: 55
Char: 13
Code: 0
Hi,
The code you posted shows you hiding all rows in the xamGrid, not particular rows. If you do that, then you're going to be essentially rendering every row, which is why you'd get a huge amount of memory consumption.
If you want to hide all rows, just set the ItemsSource to null.
If you want to hide a particular row, then set that particular row's height to zero.
void grid_CellControlAttached(object sender, CellControlAttachedEventArgs e)
MyData data = (MyData)e.Cell.Row.Data;
if (data.IsFavorite == false)
e.Cell.Row.Height = new RowHeight(0);
else
e.Cell.Row.Height = new RowHeight(30);
-SteveZ
seemes this problem has not been fully solved yet. I have this problem and have downloaded the latest SR. When the number of records is small there are no problems, but when there are a few thousands, the system crashes with an out of memory exception.
I have used a few simple lines of code:
RowHeight h0=new RowHeight(0);
RowHeight hn = new RowHeight(30);
if (setStatus == true)
xamWebGrid1.RowHeight = h0;
xamWebGrid1.RowHeight = hn;
When running this I see in taskmanager a huge consumption of memory (1Gb+) untill the out of memory exception occur.
If I use RowHeight(1) instead of 0, the memory consumption seemes to be approximately half of this, and the process is able to complete.
Ok, Thanks Steve.
Yes, you're using the release version, and this issue was fixed after the release. So, you should get the latest SR, and the issue will be resolved.
This is the version I see we are using: 10.3.20103.1006. We have a work around by which we set the Height to be 1 instead of 0, and we dont get that error. Let me know if this version would have the fix.