Thanks very much for that....I try to use the standard control when
possible but the datagrid thing is a complete pain at times...and gives
little clue of what the real problem is...inner exception is always
blank.

I managed previously to get this working with Linq2SQL....with much
wrestling it eventually did something sensible....so I just naively
tried to implement the same approach, but as you say it doesn't map the
key fields in  the same way.

Leaving the valuemember blank seems to work for normal listboxes, but
for some reason I can't seem to get it going in the grid.

I'll have a mess about for 5 mins, give up and try an infragistics grid.

> -----Original Message-----
> From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> [EMAIL PROTECTED] On Behalf Of Frans Bouma
> Sent: 05 September 2008 14:54
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] DataGridViewComboBoxColumn and entity
> framework....
> 
> > In fact saying that I can't (out of the box) get a
DataGridViewTextCell
> > to work correctly either, it displays the class name...i.e. the
default
> > ToString()....and there is no option to set which property to
display.
> 
>         I think your prob is caused by the fact that the EF doesn't
have
> the
> concept of a foreign key field in an entity.
> 
>         So say we bind northwind Orders to a datagridview and want to
pick
> the
> employees by a combobox in the employee column, you should have a
column
> of
> the 'Employee' present in the grid, and the combobox column should
have
> its
> valuemember left empty. At least that's how it works with 3rd party
grids.
> 
>         Similar to "Complex databinding example" (selfservicing /
adapter)
> available here:
> http://www.llblgen.com/pages/examples.aspx
> 
>         Not for the entity framework, but it shows how it's done. When
I
> hack
> around in that example to make it work like you would with the EF, I
too
> run
> into something which I think is a limitation of the datagridview
> combobox...:
> when I add another column which is bound to Order.Employee (the object
> property/navigator) and leave valuemember empty, and at runtime select
a
> value
> from the combobox, I get a silly text conversion error thrown by the
grid
> saying that it can't convert a string (the selectedvalue in the
combobox)
> to
> an employee object... Duh... THough it should pick the selectedITEM...
:/
> 
>         devexpress' grid does this properly though. Not sure if you
have
> that
> one available to you.
> 
>         So if you pick a real grid, perhaps it works then.
> 
>                 FB
> 
> >
> > Irratatingly I can't find any entity frameworks samples that I can
> > download...even when I follow the link on the MS web site, the
sample
> > code does not exist where they claim it does.
> >
> >
> > > -----Original Message-----
> > > From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> > > [EMAIL PROTECTED] On Behalf Of Nicholls, Mark
> > > Sent: 05 September 2008 13:26
> > > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> > > Subject: [ADVANCED-DOTNET] DataGridViewComboBoxColumn and entity
> > > framework....
> > >
> > > Has anyone got this to work?
> > >
> > > DataGridView are unpleasant things that don't tell you what the
> > problem
> > > is...
> > >
> > > I've used the Microsoft Course Sample, and ammended the Department
> > field
> > > to be a DataGridViewComboBoxColumn...
> > >
> > > bind it to a Department binding source.
> > >
> > > I'm then given a Display member...which is fine...Name.
> > >
> > > Then the value member.....ahhh....Department doesn't seem to be in
the
> > > list....and if I use DepartmentID it gets upset....probably quite
> > > sensibly.
> > >
> > > Any ideas....?
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > >
> > > View archives and manage your subscription(s) at
> > > http://discuss.develop.com
> >
> >
> >
> > CONFIDENTIALITY NOTICE
> >
> > This e-mail (and any attached files) is confidential and protected
by
> > copyright (and other intellectual property rights). If you are not
the
> > intended recipient please e-mail the sender and then delete the
email
> and
> > any attached files immediately. Any further use or dissemination is
> > prohibited.
> >
> > While MTV Networks Europe has taken steps to ensure that this email
and
> > any attachments are virus free, it is your responsibility to ensure
that
> > this message and any attachments are virus free and do not affect
your
> > systems / data.
> >
> > Communicating by email is not 100% secure and carries risks such as
> delay,
> > data corruption, non-delivery, wrongful interception and
unauthorised
> > amendment. If you communicate with us by e-mail, you acknowledge and
> > assume these risks, and you agree to take appropriate measures to
> minimise
> > these risks when e-mailing us.
> >
> > MTV Networks International, MTV Networks UK & Ireland, Greenhouse,
> > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions
> > International and Comedy Central are all trading names of MTV
Networks
> > Europe.  MTV Networks Europe is a partnership between MTV Networks
> Europe
> > Inc. and Viacom Networks Europe Inc.  Address for service in Great
> Britain
> > is UK House, 180 Oxford Street, London W1D 1DS, UK.
> >
> > ===================================
> > This list is hosted by DevelopMentor.  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> http://discuss.develop.com
> 
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
> 
> View archives and manage your subscription(s) at
> http://discuss.develop.com



CONFIDENTIALITY NOTICE

This e-mail (and any attached files) is confidential and protected by 
copyright (and other intellectual property rights). If you are not the 
intended recipient please e-mail the sender and then delete the email and 
any attached files immediately. Any further use or dissemination is 
prohibited.

While MTV Networks Europe has taken steps to ensure that this email and 
any attachments are virus free, it is your responsibility to ensure that 
this message and any attachments are virus free and do not affect your 
systems / data.

Communicating by email is not 100% secure and carries risks such as delay, 
data corruption, non-delivery, wrongful interception and unauthorised 
amendment. If you communicate with us by e-mail, you acknowledge and 
assume these risks, and you agree to take appropriate measures to minimise 
these risks when e-mailing us. 

MTV Networks International, MTV Networks UK & Ireland, Greenhouse, 
Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions 
International and Comedy Central are all trading names of MTV Networks 
Europe.  MTV Networks Europe is a partnership between MTV Networks Europe 
Inc. and Viacom Networks Europe Inc.  Address for service in Great Britain 
is UK House, 180 Oxford Street, London W1D 1DS, UK.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to