Telerik RadGrid Automatic Delete not working

Posts   
 
    
gs_ham
User
Posts: 4
Joined: 19-Jun-2007
# Posted on: 19-Jun-2007 03:16:56   

Hi, I am using the RadGrid and the LLBLGenProDataSource for 2 way databinding. Select, Insert, and Update all work great but the delete does not work. Everything looks in order based on combo of Telerik example and LLBLGenPro example. Here is my code. Any ideas?


         <radG:RadGrid ID="radGridMembers" runat="server" AllowSorting="True" EnableAJAX="True" ShowStatusBar="True" Skin="Office2007" AutoGenerateColumns="False" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"  GridLines="None" DataSourceID="ldsMembers">
                            <ClientSettings AllowColumnsReorder="True">
                                <Resizing AllowColumnResize="True" />
                            </ClientSettings>
                            <MasterTableView CommandItemDisplay="Top" CellPadding="0" DataKeyNames="PkMemberId" DataSourceID="ldsMembers">
                                <Columns>
                                    <radG:GridBoundColumn DataField="MemberName" HeaderText="Member Name"
                                            SortExpression="MemberName" UniqueName="MemberName">
                                        </radG:GridBoundColumn>
                                    <radG:GridBoundColumn DataField="EmailAddress" HeaderText="Email Address"
                                            SortExpression="EmailAddress" UniqueName="EmailAddress">
                                        </radG:GridBoundColumn>
                                    <radG:GridEditCommandColumn ButtonType="ImageButton" UpdateImageUrl="../Images/Save.gif"
                                            EditImageUrl="../Images/Edit.gif" InsertImageUrl="../Images/Save.gif"
                                            CancelImageUrl="../Images/Delete-Blue.gif">
                                            <HeaderStyle Width="20px" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </radG:GridEditCommandColumn>
                                    <radG:GridClientDeleteColumn ConfirmText="Delete this Member?" ButtonType="ImageButton"
                                            ImageUrl="../Images/Waste Bin.gif" CommandName="Delete" Text="Delete" 
                                            UniqueName="DeleteColumn" >
                                            <HeaderStyle Width="20px" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </radG:GridClientDeleteColumn>
                                </Columns>
                                <EditFormSettings ColumnNumber="2" CaptionDataField="MemberName" CaptionFormatString="Edit properties of Member {0}">
                                        <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                                        <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                                        <FormMainTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="3" BackColor="White"
                                            Width="100%" />
                                        <FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px"
                                            BackColor="White" />
                                        <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                                        <EditColumn ButtonType="ImageButton" UpdateImageUrl="../Images/Save.gif"
                                            EditImageUrl="../Images/Edit.gif" InsertImageUrl="../Images/Save.gif"
                                            CancelImageUrl="../Images/Delete-Blue.gif" InsertText="Insert Member" UpdateText="Update record"
                                            UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                                        </EditColumn>
                                        <FormTableButtonRowStyle HorizontalAlign="Left" CssClass="EditFormButtonRow" Height="30px"></FormTableButtonRowStyle>
                                    </EditFormSettings>
                                <ExpandCollapseColumn Visible="False">
                                    <HeaderStyle Width="19px" />
                                </ExpandCollapseColumn>
                                <RowIndicatorColumn Visible="False">
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                            </MasterTableView>
                        </radG:RadGrid>
                         <llblgenpro:LLBLGenProDataSource ID="ldsMembers" runat="server" DataContainerType="EntityCollection"
                            EntityCollectionTypeName="ProjectEdgeBusinessObjects.CollectionClasses.MembersCollection, ProjectEdgeBusinessObjects"
                            SortingMode="ClientSide" >
                        </llblgenpro:LLBLGenProDataSource>

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Jun-2007 05:55:55   

but the delete does not work

Exception? didn't persist DB? If you delete an entity from the grid, the entity will be deleted from the underlying EntityCollection but no at DB. You need to intercept the "TryingToDelete" event of your RadGrid and perform a delete entity manually.

adapter.DeleteEntity(interceptedEntityThatWillBeDeleted);
David Elizondo | LLBLGen Support Team
gs_ham
User
Posts: 4
Joined: 19-Jun-2007
# Posted on: 19-Jun-2007 22:48:47   

I played around with this last night and apparently it was something to do with Teleriks ClientDelete. Changed this GridClientDeleteColumn to a GridButton column and it all works perfectly.