9 Answers, 1 is accepted
0
Hi Thomas,
Can you please give me some more details on your data model (e.g. some source code or just a more detailed description of your specific scenario) . I will gladly prepare a working sample for you .
Kind regards,
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Thomas
Top achievements
Rank 1
answered on 15 Jul 2009, 07:33 PM
Hello,
I think I found a solution, but...
I have two sql database tables that I imported in the Entity Framework modeler:
A main table to bind to the grid, named LogoSets:
LogoSetID : int32 (pk)
CompanyID : int32 (fk)
Logoset1 : string
Logoset2 :string
and a table I want to use as lookup list, named companies:
CompanyID : int32 (pk)
Name : string
etc. etc. etc
The modeler creates 1 to many Navigation properties between Company and LogoSet
When I use:
<rad:GridViewComboBoxColumn Name="cbOrg" SelectedValueMemberPath="" DisplayMemberPath="Name" DataMemberBinding="{Binding Companies}" >
and
Dim getLogoSets = From l In db.LogoSets _
Select l
Dim CompanyLookUp = From o In db.Companies _
Order By o.Name _
Select o
Me.LogosetData = New LogoSetCollection(getLogoSets, db) 'ObservableCollection
Me.GridView1.DataContext = LogosetData
cbOrg.ItemsSource = CompanyLookUp.ToList
I get the result I want. The trick was setting SelectedValueMemberPath="". One big disavantage is, that the entire Companies table gets loaded. But I'm only interested in the name field.
This is bad for performance, certainly because I need to use many similar constructions like this in my application. (Maybe someone here has a solution for this? Else I think I switch over to linq-to-SQL)
I encountered two other issues with the the gridview.
1. When my dataset is empty I can't insert a new row.
2. When I insert a new row and click my mouse on an other row, cellvalidating is not called. I copied all code from the demo but I can't get it working. In the demo it works fine.
Maybe these issues are caused by the version I use: 2009.1.526.35
Many thanks,
Thomas
I think I found a solution, but...
I have two sql database tables that I imported in the Entity Framework modeler:
A main table to bind to the grid, named LogoSets:
LogoSetID : int32 (pk)
CompanyID : int32 (fk)
Logoset1 : string
Logoset2 :string
and a table I want to use as lookup list, named companies:
CompanyID : int32 (pk)
Name : string
etc. etc. etc
The modeler creates 1 to many Navigation properties between Company and LogoSet
When I use:
<rad:GridViewComboBoxColumn Name="cbOrg" SelectedValueMemberPath="" DisplayMemberPath="Name" DataMemberBinding="{Binding Companies}" >
and
Dim getLogoSets = From l In db.LogoSets _
Select l
Dim CompanyLookUp = From o In db.Companies _
Order By o.Name _
Select o
Me.LogosetData = New LogoSetCollection(getLogoSets, db) 'ObservableCollection
Me.GridView1.DataContext = LogosetData
cbOrg.ItemsSource = CompanyLookUp.ToList
I get the result I want. The trick was setting SelectedValueMemberPath="". One big disavantage is, that the entire Companies table gets loaded. But I'm only interested in the name field.
This is bad for performance, certainly because I need to use many similar constructions like this in my application. (Maybe someone here has a solution for this? Else I think I switch over to linq-to-SQL)
I encountered two other issues with the the gridview.
1. When my dataset is empty I can't insert a new row.
2. When I insert a new row and click my mouse on an other row, cellvalidating is not called. I copied all code from the demo but I can't get it working. In the demo it works fine.
Maybe these issues are caused by the version I use: 2009.1.526.35
Many thanks,
Thomas
0
Hello Thomas,
Thanks for reporting these problems . We are going to investigate them and if there is still a problem , a fix will be provided . However a lot of improvements and fixes were made to editing logic of the RadGridView since version 526. Have you tried the latest release ? Do you still experience these problems ?
Sincerely yours,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks for reporting these problems . We are going to investigate them and if there is still a problem , a fix will be provided . However a lot of improvements and fixes were made to editing logic of the RadGridView since version 526. Have you tried the latest release ? Do you still experience these problems ?
Sincerely yours,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Thomas
Top achievements
Rank 1
answered on 29 Jul 2009, 08:34 AM
Hello,
I have installed the latest version, 2009.2.701.35, and switched over to linq-to-sql. Now I have some strange behavior with the gridviewcomboboxcolumn. When I begin to edit, the combobox doesn't show (always) the selected value.
I have made the following sample project to demonstrate the problem.
I hope you find some time to investigate this problem.
Many thanks,
Thomas.
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<Grid>
<telerik:RadGridView ItemsSource="{Binding}" AutoGenerateColumns="False" Name="RadGridView1">
<telerik:RadGridView.Columns>
<telerik:GridViewComboBoxColumn Header="Company" DataMemberBinding="{Binding CompanyID}" DisplayMemberPath="Name" SelectedValueMemberPath="CompanyID"></telerik:GridViewComboBoxColumn>
<telerik:GridViewDataColumn Header="Logoset" DataMemberBinding="{Binding Set1}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</Window>
Imports System.Collections.ObjectModel
Imports Telerik.Windows.Controls
Class Window1
Private LogoSets As New ObservableCollection(Of Logoset)
Private Companies As New ObservableCollection(Of Company)
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim org1 As New Company With {.CompanyID = 1, .Name = "Acme"}
Dim org2 As New Company With {.CompanyID = 2, .Name = "Nasa"}
Companies.Add(org1)
Companies.Add(org2)
Dim ls1 As New Logoset With {.CompanyID = 1, .Set1 = "Set1"}
Dim ls2 As New Logoset With {.CompanyID = 1, .Set1 = "Set2"}
Dim ls3 As New Logoset With {.CompanyID = 2, .Set1 = "Set3"}
LogoSets.Add(ls1)
LogoSets.Add(ls2)
LogoSets.Add(ls3)
RadGridView1.DataContext = LogoSets
CType(RadGridView1.Columns(0), GridViewComboBoxColumn).ItemsSource = Companies
End Sub
End Class
Public Class Logoset
Private _companyID As Int32
Public Property CompanyID() As Int32
Get
Return _companyID
End Get
Set(ByVal value As Int32)
_companyID = value
End Set
End Property
Private _set1 As String
Public Property Set1() As String
Get
Return _set1
End Get
Set(ByVal value As String)
_set1 = value
End Set
End Property
End Class
Public Class Company
Private _companyID As Int32
Public Property CompanyID() As Int32
Get
Return _companyID
End Get
Set(ByVal value As Int32)
_companyID = value
End Set
End Property
Private _name As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
End Class
I have installed the latest version, 2009.2.701.35, and switched over to linq-to-sql. Now I have some strange behavior with the gridviewcomboboxcolumn. When I begin to edit, the combobox doesn't show (always) the selected value.
I have made the following sample project to demonstrate the problem.
I hope you find some time to investigate this problem.
Many thanks,
Thomas.
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<Grid>
<telerik:RadGridView ItemsSource="{Binding}" AutoGenerateColumns="False" Name="RadGridView1">
<telerik:RadGridView.Columns>
<telerik:GridViewComboBoxColumn Header="Company" DataMemberBinding="{Binding CompanyID}" DisplayMemberPath="Name" SelectedValueMemberPath="CompanyID"></telerik:GridViewComboBoxColumn>
<telerik:GridViewDataColumn Header="Logoset" DataMemberBinding="{Binding Set1}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</Window>
Imports System.Collections.ObjectModel
Imports Telerik.Windows.Controls
Class Window1
Private LogoSets As New ObservableCollection(Of Logoset)
Private Companies As New ObservableCollection(Of Company)
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim org1 As New Company With {.CompanyID = 1, .Name = "Acme"}
Dim org2 As New Company With {.CompanyID = 2, .Name = "Nasa"}
Companies.Add(org1)
Companies.Add(org2)
Dim ls1 As New Logoset With {.CompanyID = 1, .Set1 = "Set1"}
Dim ls2 As New Logoset With {.CompanyID = 1, .Set1 = "Set2"}
Dim ls3 As New Logoset With {.CompanyID = 2, .Set1 = "Set3"}
LogoSets.Add(ls1)
LogoSets.Add(ls2)
LogoSets.Add(ls3)
RadGridView1.DataContext = LogoSets
CType(RadGridView1.Columns(0), GridViewComboBoxColumn).ItemsSource = Companies
End Sub
End Class
Public Class Logoset
Private _companyID As Int32
Public Property CompanyID() As Int32
Get
Return _companyID
End Get
Set(ByVal value As Int32)
_companyID = value
End Set
End Property
Private _set1 As String
Public Property Set1() As String
Get
Return _set1
End Get
Set(ByVal value As String)
_set1 = value
End Set
End Property
End Class
Public Class Company
Private _companyID As Int32
Public Property CompanyID() As Int32
Get
Return _companyID
End Get
Set(ByVal value As Int32)
_companyID = value
End Set
End Property
Private _name As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
End Class
0
Thomas
Top achievements
Rank 1
answered on 30 Jul 2009, 11:06 AM
Hello,
I partly solved my problem, but in the project I'm working on I still have the same problem.
By setting RadGridView1.ItemsSource= LogoSets, the problem is solved for the example above.
After analyzing my project I found the cause of the problem, but I don't have the solution.
In this project, a new window which contains the radgridview is opened . When I place a HeaderedItemsControl in the main window, the problem reoccurs.
No problems with this solution.
<Window x:Class="MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="300">
<Grid>
<StackPanel>
<Button Click="Button1_Click">Button</Button>
</StackPanel>
</Grid>
</Window>
Class MainView
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Dim w As New Window1
w.Owner = Me
w.ShowDialog()
End Sub
End Class
But when I change to this:
<Window x:Class="MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="300">
<Grid>
<StackPanel>
<Menu></Menu>
<Button Click="Button1_Click">Button</Button>
</StackPanel>
</Grid>
</Window>
the GridViewComboBoxColumn doesn't work as expected.
Greetings,
Thomas.
I partly solved my problem, but in the project I'm working on I still have the same problem.
By setting RadGridView1.ItemsSource= LogoSets, the problem is solved for the example above.
After analyzing my project I found the cause of the problem, but I don't have the solution.
In this project, a new window which contains the radgridview is opened . When I place a HeaderedItemsControl in the main window, the problem reoccurs.
No problems with this solution.
<Window x:Class="MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="300">
<Grid>
<StackPanel>
<Button Click="Button1_Click">Button</Button>
</StackPanel>
</Grid>
</Window>
Class MainView
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Dim w As New Window1
w.Owner = Me
w.ShowDialog()
End Sub
End Class
But when I change to this:
<Window x:Class="MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Height="300" Width="300">
<Grid>
<StackPanel>
<Menu></Menu>
<Button Click="Button1_Click">Button</Button>
</StackPanel>
</Grid>
</Window>
the GridViewComboBoxColumn doesn't work as expected.
Greetings,
Thomas.
0
Hi Thomas,
I have tried to replicate you problem, but everything works as expected. I'm attaching my solution, so that you can verify on your PC. Are you doing something specific that you have not mentioned in the forum thread?
Greetings,
Stefan Dobrev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I have tried to replicate you problem, but everything works as expected. I'm attaching my solution, so that you can verify on your PC. Are you doing something specific that you have not mentioned in the forum thread?
Greetings,
Stefan Dobrev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Thomas
Top achievements
Rank 1
answered on 03 Aug 2009, 02:30 PM
Hi,
Thanks again for your quick reply.
I have the same problem when I run your example project. Both on a windows 2003 server as on my XP laptop.
Software:
Windows .NET framework 3.5 sp1
telerik version: 2009.2.701.35 (not registered for now)
Again, the problem is after I click on the company field. When I start with the top record, the selected value is shown, however when I click on the next record the value is empty.
When I use entity framework in my project and set SelectedValueMemberPath="", I don't have this problem.
Greetings Thomas.
Thanks again for your quick reply.
I have the same problem when I run your example project. Both on a windows 2003 server as on my XP laptop.
Software:
Windows .NET framework 3.5 sp1
telerik version: 2009.2.701.35 (not registered for now)
Again, the problem is after I click on the company field. When I start with the top record, the selected value is shown, however when I click on the next record the value is empty.
When I use entity framework in my project and set SelectedValueMemberPath="", I don't have this problem.
Greetings Thomas.
0
Hello Thomas,
Following the steps you have described I was able to reproduce the problem this time. The good news is that we have already fix this as part of ongoing refactoring of current editing logic. The fix will be available in our next services pack targeted for the next week of August.
Kind regards,
Stefan Dobrev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Following the steps you have described I was able to reproduce the problem this time. The good news is that we have already fix this as part of ongoing refactoring of current editing logic. The fix will be available in our next services pack targeted for the next week of August.
Kind regards,
Stefan Dobrev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Thomas
Top achievements
Rank 1
answered on 06 Aug 2009, 03:25 PM
Hi,
It great to hear that you have a fix so soon.
Thanks.
Thomas
It great to hear that you have a fix so soon.
Thanks.
Thomas