RadGrid/LINQ: CRUD not working at all (maybe not firing?)

1 Answer 29 Views
Ajax Grid
Paul
Top achievements
Rank 1
Iron
Paul asked on 03 May 2022, 03:34 PM | edited on 03 May 2022, 04:05 PM
I've put a RadGrid into my page, bound it to a LINQ source.  It fetches data properly but will not update. Only the cancel button operates, update does nothing at all.  I've tried doing it manually as well, tore out the grid and just put one in with no customizing and same thing.  When I tried to do it manually, it behaved as though the button events weren't firing at all... here's my code: 
I've done this previously, although I'm (more than) a bit rusty... but can't for the life of me see what I'm doing wrong.

Thanks!


<telerik:RadGrid ID="TenantGrid" runat="server" AutoGenerateDeleteColumn="True" 
                AutoGenerateEditColumn="True" CellSpacing="0" DataSourceID="LinqDataSource2" 
                GridLines="None">
                <ClientSettings>
                    <Selecting CellSelectionMode="None" />
                </ClientSettings>
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" 
                    DataSourceID="LinqDataSource2">
                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" 
                        Visible="True">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
                        Visible="True">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Name" 
                            FilterControlAltText="Filter Name column" HeaderText="Name" 
                            SortExpression="Name" UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Location" 
                            FilterControlAltText="Filter Location column" HeaderText="Location" 
                            SortExpression="Location" UniqueName="Location">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Phone" 
                            FilterControlAltText="Filter Phone column" HeaderText="Phone" 
                            SortExpression="Phone" UniqueName="Phone">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" 
                            FilterControlAltText="Filter Email column" HeaderText="Email" 
                            SortExpression="Email" UniqueName="Email">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Contact" 
                            FilterControlAltText="Filter Contact column" HeaderText="Contact" 
                            SortExpression="Contact" UniqueName="Contact">
                        </telerik:GridBoundColumn>
                        <telerik:GridCheckBoxColumn DataField="Active" DataType="System.Boolean" 
                            FilterControlAltText="Filter Active column" HeaderText="Active" 
                            SortExpression="Active" UniqueName="Active">
                        </telerik:GridCheckBoxColumn>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" 
                            FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" 
                            SortExpression="ID" UniqueName="ID">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>


 <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
                ContextTypeName="FrontDesk.FrontDeskDataContext" EnableDelete="True" 
                EnableInsert="True" EnableUpdate="True" EntityTypeName="" TableName="Tenants">
            </asp:LinqDataSource>

1 Answer, 1 is accepted

Sort by
0
Accepted
Paul
Top achievements
Rank 1
Iron
answered on 03 May 2022, 05:46 PM

I knew I had seen this once before, so dug through notes from years ago and came up with the answer that I'll leave here in case it helps someone... in fact the update button (and apparently only the update button) was causing a validation and buried in the settings I added this:

<ValidationSettings EnableModelValidation="false" EnableValidation="false" ValidationGroup="10" /> 

Not sure why it worked, or was necessary, but it did.

Vessy
Telerik team
commented on 06 May 2022, 04:55 AM

Great! Thank you for sharing your solution with the community, Paul!
Tags
Ajax Grid
Asked by
Paul
Top achievements
Rank 1
Iron
Answers by
Paul
Top achievements
Rank 1
Iron
Share this question
or