DevExpress DataGrid,LinqDataSource,行插入问题

时间:2013-02-14 17:27:40

标签: devexpress linqdatasource

以下是问题的屏幕截图:

http://screencast.com/t/ZG2NQWjxYFLh

我正在尝试使用DevExpress数据网格通过Linq向数据库添加记录。提交数据时,错误是:

LinqDataSource'linqDsLocales'没有要插入的值。检查'values'字典是否包含值。

这就是我的LinqDataSource:

<asp:LinqDataSource ID="linqDsLocales" runat="server" ContextTypeName="MyCompany.MyObject.DataDataContext" TableName="Locales" EnableInsert="True" EnableUpdate="True" EnableDelete="True" />

这是网格:

<dx:ASPxGridView ID="gridLocales" runat="server" AutoGenerateColumns="False" DataSourceID="linqDsLocales" KeyFieldName="LocaleID">
                    <Columns>
                        <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0">
                            <EditButton Visible="True" />
                            <NewButton Visible="True" />
                            <DeleteButton Visible="True" />
                        </dx:GridViewCommandColumn>
                        <dx:GridViewDataTextColumn FieldName="LocaleID" ReadOnly="True" VisibleIndex="1">
                            <EditFormSettings Visible="False" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Name" VisibleIndex="2"/>                            
                        <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="3"/>
                    </Columns>
                    <Settings ShowFilterRow="True" />
                    <Templates>
                        <EditForm>

                            <dx:ASPxPageControl ID="tabLocaleEditController" runat="server" ActiveTabIndex="0" Width="100%">
                                <TabPages>

                                    <dx:TabPage Text="Locale Information">
                                        <ContentCollection>
                                            <dx:ContentControl runat="server">
                                                <dx:ASPxGridViewTemplateReplacement ID="localeEditors" ReplacementType="EditFormEditors" runat="server" />
                                            </dx:ContentControl>
                                        </ContentCollection>
                                    </dx:TabPage>

                                    <dx:TabPage Text="Role Assigment">
                                        <ContentCollection>
                                            <dx:ContentControl runat="server">
                                                <dx:ASPxCheckBoxList ID="cbListRoles" runat="server" ValueType="System.String" DataSourceID="linqDsRoles" TextField="RoleName" ValueField="RoleID" OnDataBound="cbListRoles_OnDataBound" />
                                            </dx:ContentControl>
                                        </ContentCollection>
                                    </dx:TabPage>

                                </TabPages>
                            </dx:ASPxPageControl>

                            <div style="text-align: right; padding: 2px 2px 2px 2px">
                                <dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server" />
                                <dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server" />
                            </div>

                        </EditForm>
                    </Templates>

                </dx:ASPxGridView>  

任何人都可以对此有所了解吗?

0 个答案:

没有答案