This is a migrated thread and some comments may be shown as answers.

Edit and Delete not working in LINQ Datasource

3 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 17 Sep 2008, 09:29 PM
Hi guys,$0$0$0$0I have created a small web application with your controls, and all my data displayed fine, I hand wrote the LINQ queries and had no problems at all. I then decided to enable the edit/delete modes for a couple of the grids I am making use of, and it visually seemed fine, so I presumed that it was working... how wrong I was!$0$0$0$0$0If you click "delete", it reloads the page, but nothing happens to the record.$0$0If you click "edit", you go into inline edit mode, make your changes, click "update", page reloads but all data is reset to what it was before your changes!$0$0$0$0$0I changed my LINQ query to a LINQ Database for one grid, just to test if that was perhaps the issue, and it seems that I am still having the same trouble. Could somebody help me figure out what exactly I am doing wrong here please?$0$0$0$0$0$0$0$0$0$0$0$0<fieldset> $0$0$0$0$0$0                        <legend>Service History<asp:LinqDataSource ID="LinqDataSource1" runat="server"  $0$0$0$0$0$0                                ContextTypeName="db_vmmDataContext"  $0$0$0$0$0$0                                Select="new (ServiceDate, ServicedBy, InvoiceNo, Mileage, ServiceType, DateTyresLastPurchased, NextServiceDueMiles, NextServiceDueDt, MOTd, WhatWasDone)"  $0$0$0$0$0$0                                TableName="vmm_ServiceHistories" Where="VehicleID == @VehicleID"$0$0$0$0$0$0                            <whereparameters> $0$0$0$0$0$0                                <asp:ControlParameter ControlID="lstVehicleSelectByReg" Name="VehicleID"  $0$0$0$0$0$0                                PropertyName="SelectedValue" Type="Int32" /> $0$0$0$0$0$0                            </whereparameters> $0$0$0$0$0$0                            </asp:LinqDataSource> $0$0$0$0$0$0                        </legend> $0$0$0$0$0$0                        <div> $0$0$0$0$0$0                            <telerik:RadGrid ID="rpt_ServiceHistory" runat="server" skin="Hay"  $0$0$0$0$0$0                                GridLines="None" AutoGenerateDeleteColumn="True" DataMember="DefaultView"  $0$0$0$0$0$0                                DataSourceID="LinqDataSource1" AutoGenerateEditColumn="True"  $0$0$0$0$0$0                                AllowAutomaticDeletes="True" AllowAutomaticUpdates="True"$0$0$0$0$0$0                                <MasterTableView AutoGenerateColumns="True" datamember="DefaultView" datasourceid="LinqDataSource1"  $0$0$0$0$0$0                                editmode="InPlace"$0$0$0$0$0$0                                    <RowIndicatorColumn> $0$0$0$0$0$0                                        <HeaderStyle Width="20px"></HeaderStyle> $0$0$0$0$0$0                                    </RowIndicatorColumn> $0$0$0$0$0$0                                    <ExpandCollapseColumn> $0$0$0$0$0$0                                        <HeaderStyle Width="20px"></HeaderStyle> $0$0$0$0$0$0                                    </ExpandCollapseColumn> $0$0$0$0$0$0                             $0$0$0$0$0$0                                </MasterTableView> $0$0$0$0$0$0                                <FilterMenu EnableTheming="True"$0$0$0$0$0$0                                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> $0$0$0$0$0$0                                </FilterMenu> $0$0$0$0$0$0                            </telerik:RadGrid> $0$0$0$0$0$0                        </div> $0$0$0$0$0$0                    </fieldset> $0$0$0$0$0$0$0

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Sep 2008, 07:08 AM
Hello Justin,

You can go through the following code library submission link and verify if you have missed out on something. The project attached explains how to perform automatic operations with LinqDataSource in the grid.
Automatic Operations with LinqDataSource

Thanks
Princy.
0
Justin
Top achievements
Rank 1
answered on 18 Sep 2008, 09:59 PM
Hi Princy,$0$0$0$0I downloaded the package and had a look at it, and unfortunately it was of no help at all. Once again, please find attached my code, if somebody could give me an idea of what I have done incorrectly, I would appreciate it.$0$0$0$0$0Regards,$0$0Justin$0$0$0$0$0$0$0$0$0$0$0$0<fieldset> $0$0$0$0$0$0                        <legend>Service History $0$0$0$0$0$0                            <asp:LinqDataSource ID="LinqDataSource1" runat="server"  $0$0$0$0$0$0                                ContextTypeName="db_vmmDataContext"  $0$0$0$0$0$0                                Select="new (ServiceDate, ServicedBy, InvoiceNo, Mileage, ServiceType, DateTyresLastPurchased, NextServiceDueMiles, NextServiceDueDt, MOTd, WhatWasDone)"  $0$0$0$0$0$0                                TableName="vmm_ServiceHistories" Where="VehicleID == @VehicleID"$0$0$0$0$0$0                            <whereparameters> $0$0$0$0$0$0                                <asp:ControlParameter ControlID="lstVehicleSelectByReg" Name="VehicleID"  $0$0$0$0$0$0                                PropertyName="SelectedValue" Type="Int32" /> $0$0$0$0$0$0                            </whereparameters> $0$0$0$0$0$0                            </asp:LinqDataSource> $0$0$0$0$0$0                        </legend> $0$0$0$0$0$0                        <div> $0$0$0$0$0$0                            <telerik:RadGrid AutoGenerateDeleteColumn="True" ID="rpt_ServiceHistory" runat="server" skin="Hay"  $0$0$0$0$0$0                                GridLines="None" DataMember="DefaultView"  $0$0$0$0$0$0                                DataSourceID="LinqDataSource1" AutoGenerateEditColumn="True"  $0$0$0$0$0$0                                AllowAutomaticDeletes="True" AllowAutomaticUpdates="True"$0$0$0$0$0$0                                <MasterTableView AutoGenerateColumns="True" datamember="DefaultView" datasourceid="LinqDataSource1"  $0$0$0$0$0$0                                editmode="InPlace"$0$0$0$0$0$0                                    <RowIndicatorColumn> $0$0$0$0$0$0                                        <HeaderStyle Width="20px"></HeaderStyle> $0$0$0$0$0$0                                    </RowIndicatorColumn> $0$0$0$0$0$0                                    <ExpandCollapseColumn> $0$0$0$0$0$0                                        <HeaderStyle Width="20px"></HeaderStyle> $0$0$0$0$0$0                                    </ExpandCollapseColumn> $0$0$0$0$0$0                             $0$0$0$0$0$0                                </MasterTableView> $0$0$0$0$0$0                                <FilterMenu EnableTheming="True"$0$0$0$0$0$0                                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> $0$0$0$0$0$0                                </FilterMenu> $0$0$0$0$0$0                            </telerik:RadGrid> $0$0$0$0$0$0                        </div> $0$0$0$0$0$0                    </fieldset> $0$0$0$0$0$0$0
0
Justin
Top achievements
Rank 1
answered on 18 Sep 2008, 10:01 PM
My browser seemed to have messed up the paste, so I am attempting to paste again with IE this time.

<fieldset> 
                        <legend>Service History  
                            <asp:LinqDataSource ID="LinqDataSource1" runat="server"   
                                ContextTypeName="db_vmmDataContext"   
                                Select="new (ServiceDate, ServicedBy, InvoiceNo, Mileage, ServiceType, DateTyresLastPurchased, NextServiceDueMiles, NextServiceDueDt, MOTd, WhatWasDone)"   
                                TableName="vmm_ServiceHistories" Where="VehicleID == @VehicleID">  
                            <whereparameters> 
                                <asp:ControlParameter ControlID="lstVehicleSelectByReg" Name="VehicleID"   
                                PropertyName="SelectedValue" Type="Int32" /> 
                            </whereparameters> 
                            </asp:LinqDataSource> 
                        </legend> 
                        <div> 
                            <telerik:RadGrid AutoGenerateDeleteColumn="True" ID="rpt_ServiceHistory" runat="server" skin="Hay"   
                                GridLines="None" DataMember="DefaultView"   
                                DataSourceID="LinqDataSource1" AutoGenerateEditColumn="True"   
                                AllowAutomaticDeletes="True" AllowAutomaticUpdates="True">  
                                <MasterTableView AutoGenerateColumns="True" datamember="DefaultView" datasourceid="LinqDataSource1"   
                                editmode="InPlace">  
                                    <RowIndicatorColumn> 
                                        <HeaderStyle Width="20px"></HeaderStyle> 
                                    </RowIndicatorColumn> 
                                    <ExpandCollapseColumn> 
                                        <HeaderStyle Width="20px"></HeaderStyle> 
                                    </ExpandCollapseColumn> 
                              
                                </MasterTableView> 
                                <FilterMenu EnableTheming="True">  
                                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                                </FilterMenu> 
                            </telerik:RadGrid> 
                        </div> 
                    </fieldset> 
Tags
Grid
Asked by
Justin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Justin
Top achievements
Rank 1
Share this question
or