views:

32

answers:

0

Hi,

I am using a XamDataGrid to populate say books. I want to ADD/EDIT/DELETE books from XamDataGrid and the change should reflect in the database. i.e. when I edit the record in XamDataGrid changes should be stored in the database similarly for Add and Delete. Can anyone please give me sample code or explanation how to achieve this?

I tried using this but it didn't worked.

    <ig:XamDataGrid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0"
            Canvas.Left="0" Canvas.Top="118" Height="287" DataSource="{Binding Books }"
            Name="xdgBooks" Width="788" GroupByAreaLocation="None" >
        <!--

        -->
        <ig:XamDataGrid.FieldLayoutSettings>
            <ig:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True"
                    AddNewRecordLocation="OnTopFixed" AllowDelete="False"
                    SelectionTypeCell="Single" SelectionTypeField="None" SelectionTypeRecord="Single" />
        </ig:XamDataGrid.FieldLayoutSettings>

        <ig:XamDataGrid.FieldSettings>
            <ig:FieldSettings AllowEdit="True" />
        </ig:XamDataGrid.FieldSettings>

        <ig:XamDataGrid.FieldLayouts>
            <ig:FieldLayout Key="BookModel" >
                <ig:Field Name="Id" Label="Category ID" ></ig:Field>
                <ig:Field Name="Description" Label="Description"></ig:Field>
                <ig:Field Name="Name" Label="Name"></ig:Field>
                <ig:Field Name="Author" Label="Author"></ig:Field>
                <ig:Field Name="pub_date" Label="publish Date"></ig:Field>
            </ig:FieldLayout>
        </ig:XamDataGrid.FieldLayouts>
    </ig:XamDataGrid>