This is a migrated thread and some comments may be shown as answers.

ComboBox in GridView is throw error in Q3 1023

8 Answers 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wirat Chinnan
Top achievements
Rank 1
Wirat Chinnan asked on 30 Oct 2009, 09:47 AM
I upgrade from Silverlight Q3 beta 2 to Silverlight Q3 1023. When I select item in comboxbox. It  throw error as

Error: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.
   at Telerik.Windows.RadRoutedEventHelper.CheckParameters(EventRoute route, RadRoutedEventArgs args)
   at Telerik.Windows.RadRoutedEventHelper.BuildRoute(DependencyObject element, EventRoute route, RadRoutedEventArgs args)
   at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
   at Telerik.Windows.DependencyObjectExtensions.RaiseEvent(DependencyObject element, RadRoutedEventArgs e)
   at Telerik.Windows.Controls.GridView.EditContext.RaiseCellValidatingEvent(GridViewCell cell)
   at Telerik.Windows.Controls.GridView.EditContext.ValidateCell(GridViewCell cell)
   at Telerik.Windows.Controls.GridView.EditContext.PerformCellValidation(GridViewCell cell)
   at Telerik.Windows.Controls.GridView.EditContext.CommitCellEdit(GridViewCell currentCell, Boolean isLeavingRow)
   at Telerik.Windows.Controls.GridView.EditContext.CanCellBecomeCurrent(GridViewCell cell)
   at Telerik.Windows.Controls.GridView.GridViewCell.CanCellBecomeCurrent()
   at Telerik.Windows.Controls.GridView.GridViewCell.OnCoerceIsCurrent(DependencyObject target, Object baseValue)
   at Telerik.Windows.PropertyMetadata.CoerceValue(DependencyObject d, DependencyPropertyChangedEventArgs e, CoerceValueCallback callback)
   at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.GridView.GridViewCell.set_IsCurrent(Boolean value)
   at Telerik.Windows.Controls.GridView.GridViewCell.ResumeCurrentState()
   at Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column)
   at Telerik.Windows.Controls.GridView.DataCellsPresenter.PrepareContainerForItemOverride(DependencyObject element, Object item)
   at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
   at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertNewContainer(Int32 childIndex, UIElement container)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, Int32& childIndex, Size& childSize)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChildren(IItemContainerGenerator generator, Int32 startIndex, Int32 endIndex, Size constraint)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateAndMeasureChildrenForRealizedColumns(Size constraint)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)     

Source File: http://creative:8000/SLApp.Web/Main.aspx
Line: 56

How do I solve this problem?

8 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 30 Oct 2009, 12:10 PM
Hello Wirat Chinnan,

Can you please give me some more details on how to reproduce the problem here. Can you please paste me the code with the combobox settings as well as more info on the data you  are using to populate the combo . 

I will be glad to provide a solution as soon as I can reproduce the problem here.

Regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Wirat Chinnan
Top achievements
Rank 1
answered on 30 Oct 2009, 01:48 PM
<sc:DataGridControl ItemsSource="{Binding Path=TestList.CurPageItems}"  SelectedIndex="{Binding >
<sc:DataGridControl.Columns>
<sc:GridColumn DataMemberBinding="{Binding companytypeid}">
<sc:GridColumn.CellTemplate>
<DataTemplate>
<sc:Label  Content="{Binding Path=companytypeid_Show,Mode=OneWay}"/>
</DataTemplate>
</sc:GridColumn.CellTemplate>
<sc:GridColumn.CellEditTemplate>
<DataTemplate>
<RadComboBox  SelectedValue="{Binding Path=companytypeid,Mode=TwoWay}" ItemsSource="{Binding Path=companytypeid_DSList}" SelectedValuePath="Key" DisplayMemberPath="Value"/>
</DataTemplate>
</sc:GridColumn.CellEditTemplate>
</sc:GridColumn>
</sc:DataGridControl.Columns> 
</sc:DataGridControl>

FYI
- sc:DataGridControl is inherited from RadGridView
- sc:GridView is Inherited from GridViewDataColumn
- When companytypeid is changed , we re-calculate value of companytypeid_Show

Combobox can populate data but when I select item in combobox the error will throw
0
Pavel Pavlov
Telerik team
answered on 03 Nov 2009, 01:57 PM
Hello Wirat Chinnan,

Using custom cell template and cell edit template is intended for non-trivial scenarios.
In your case you I would highly recommend to use the integrated GridViewComboBox column  instead of redefining the cell template.

All you need to do is set a few properties of the column and it will handle editing , display mode and combo box editor without the troubles you are experiencing right now.

You may find more about the usage of GridViewComboBox column in this article.

If you find any troubles implementing this , you are always welcome to send me your project and I will be glad to make the modifications necessary .

* To be able to attach the project you will need to open a support ticket.

Sincerely yours,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Adalsteinn Thorbergsson
Top achievements
Rank 1
answered on 12 Nov 2009, 03:02 PM
Hi Pavel,

The example in the article doesnt work with .NET RIA. 
I populated the Country table with the entire table data and linked the data but still no values are displayed.
SelectedValueMemberPath="ID"
DisplayMemberPath="Name"
DataMemberBinding="{Binding CountryID}"

I tried creating a <RadGridView Loaded ="" /> to make sure that the data was loaded in the context and it is but still the ComboBox is not displaying any data.

thanks, Alli
0
Pavel Pavlov
Telerik team
answered on 17 Nov 2009, 06:30 PM
Hi Adalsteinn Thorbergsson,

Have you set  the ItemsSource property of the column ?

Kind regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marc Roussel
Top achievements
Rank 2
answered on 07 Apr 2010, 06:05 PM
I confirm that data isn't display. when the combobox is bound to an object of the DataContext which is the case of .NET RIA
and I'm using WCF all manually myself and have an object as property and I have the same issue trying to figure out how the binding works for showing the value and having the combobox filled with the same object as the one in the selected row

I did place a ticket.

Seems the same problem for Silverlight 3 many version of telerik and Silverlight 4 with 1040
0
Pavel Pavlov
Telerik team
answered on 13 Apr 2010, 01:12 PM
Hello Marc Roussel,

When speaking of RIA  and ComboBoxColumn - there indeed is a known issue  we are resolving currently .  Since data may come later the ComboBoxColumn does not sense this and combobxes remain blank.  There are two workarounds for the issue:
1. Use a regular column and place a combobox inside the cell template
2. Force loading the ItemsSource data before the initialization of the ComboBox column (e.g.  by calling the respective method of the DomainDataSource) .

Kind regards,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Marc Roussel
Top achievements
Rank 2
answered on 17 Apr 2010, 11:40 AM
Ok I've read in an article somewhere which I lost the link that it's effectively a Equals() problems.
I did a test myself and it's really the problem,  The fact that the object in the grid doesn't come from the ComboBox collection
even tought it's the same object with same properties and same data.  The hash table have a leak !

If I do regain the object from the ComboBox after the ItemsSource was set, it works fine.
Tags
GridView
Asked by
Wirat Chinnan
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Wirat Chinnan
Top achievements
Rank 1
Adalsteinn Thorbergsson
Top achievements
Rank 1
Marc Roussel
Top achievements
Rank 2
Share this question
or