DataGrid make with DataSource Wizard, after add tree buttons for basic operations.
In button1_Click_1 event, add o following code:
ChildWindow1 frm = new ChildWindow1();
frm.dataForm1.CurrentItem = ((IEditableCollectionView)pessoaDomainDataSource.DataView).AddNew() as SistemaWEB.Web.Contexts.pessoa;
frm.Closed += new EventHandler(frm_Closed2);
frm.Show();
When no data is researched
and calls the code above, the following error is posted "'AddNew' is not supported by this ICollectionView."
But if I search for something before, nothing happens.
Actually you should be able to add the entity a number of places (DataForm, DomainDataSource.DataView, or DomainContext). The current limitation is due to a bug.
rogerio_bassete
0 Points
2 Posts
DomainDataSource.DataView Error Add new Record
Mar 24, 2010 05:34 PM | LINK
Hello,
When adding a new record in DomainDataSource, do the following:
((IEditableCollectionView) pessoaDomainDataSource.DataView). AddNew () as Teste.Web.Contexts.pessoa;But if not carry anything in the DataGrid before, the above statement fails! To resolve this, I'm calling the Load () method as follows:
Correct?
Rogerio Bassete
Brazil
mohnani.deepesh
Member
677 Points
137 Posts
Microsoft
Re: DomainDataSource.DataView Error Add new Record
Mar 24, 2010 09:13 PM | LINK
Could u elaborate more about your scenario. Thanks
Program Manager
twitter:@deepeshm
blog: http://blogs.msdn.com/deepm
***This posting is provided "AS IS" with no warranties, and confers no rights ***
rogerio_bassete
0 Points
2 Posts
Re: DomainDataSource.DataView Error Add new Record
Mar 25, 2010 11:40 AM | LINK
OK, I´m sorry for short description.
Code of DataGrid
DataGrid make with DataSource Wizard, after add tree buttons for basic operations.
In button1_Click_1 event, add o following code:
When no data is researched and calls the code above, the following error is posted "'AddNew' is not supported by this ICollectionView."
But if I search for something before, nothing happens.
Environment:
Windows 7 Professional
Visual Studio 2010 RC + SilverLight 4
SilverLight 4 Tools
kylemc
Contributor
7243 Points
1147 Posts
Microsoft
Re: DomainDataSource.DataView Error Add new Record
Mar 25, 2010 06:05 PM | LINK
This may be a framework bug. Until we determine how to fix the bug, you can use this workaround to avoid it.
Set the QueryName in the contructor of your page and not in xaml.
Kylesladapter
All-Star
43609 Points
7910 Posts
Re: DomainDataSource.DataView Error Add new Record
Mar 25, 2010 06:12 PM | LINK
You need to add the new Item to the DomainContext entity collection, not in the DataView:
possoa p = new possoa();
YourDomainContext.possoas.Add(p);
Software Engineer
Aprimo, Inc
Please remember to mark the replies as answers if they answered your question
kylemc
Contributor
7243 Points
1147 Posts
Microsoft
Re: DomainDataSource.DataView Error Add new Record
Mar 25, 2010 06:21 PM | LINK
Actually you should be able to add the entity a number of places (DataForm, DomainDataSource.DataView, or DomainContext). The current limitation is due to a bug.
Kyle
vrubel
Member
6 Points
3 Posts
Re: DomainDataSource.DataView Error Add new Record
Apr 13, 2011 10:54 PM | LINK
should be the method "insert" for entity on the server side.
[Insert]
public void InsertBlaBla(BlaBla blaBla)
{
}