Hi,
I want to provider AddNew,Delete and update option in the xamdataGrid.I am binding to BindingList<T> collection.It shows the AddNew Button but it is disabled.I unable to add a new record.Below is the source code.
<igDP:XamDataGrid HorizontalAlignment="Stretch" UpdateMode="OnCellChangeOrLostFocus" VerticalAlignment="Stretch" DataSource="{Binding Path=BusinessObjectCollection}" Margin="0,0,0,0" Grid.Row="0" GroupByAreaLocation="None">
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings AllowEdit="True"/>
</igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True" AllowDelete="True" SelectionTypeCell="Single" SelectionTypeField="None" SelectionTypeRecord="Single"/>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:FieldLayout.Fields>
<igDP:Field Name="FirstName" Label="First Name">
<igDP:Field.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}"></igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="LastName" Label="Last Name"/>
<igDP:Field Name="Address"/>
<igDP:Field Name="PhoneNumber"/>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
C# Code:
{
SalesRegion Region = Database.GetSalesRegion(2);
SalesPersons.Add(person);
}
Thanks in Advance
As I indicated in the post to which I referred you, in order for BindingList<T> to support addnew, you must either handle the AddingNew event of the BindingList<T> and set e.NewObject to the object that should be used or the T must be a public non-abstract class with a public parameterless constructor. Your snippet indicates that the T is BaseDTO. I'm assuming that the Base means it does not meet this criteria.
Still i am facing the same issue.I am able to edit the records but i am not able to add the record.I have enabled AllowNew=true in BindingList<T>.
I really apperciate your help in this.
Thanks,
R.Ramesh Babu.
The forums aren't a means for official support from Infragistics. When you need immediate support you should contact the support group - http://ko.infragistics.com/support/default.aspx. With regards to your question, you should read this post since I believe the same issue applies here. Until you get your BindingList<T>'s AllowNew to return true, the grid will not be able to support adding new records.