locked
why i can only edit / delete FIRST ROW in results RRS feed

  • Question

  • User1380666226 posted

     i have a simple sql database displaying data in a GridView control.. 

    When i go to Edit and/or Delete a record, i can do this fine on the first record, BUT THAT'S ALL!

    The other's do nothing. 

    Dumb Question, but could it be because i've recently turned off indexing on my XP Pro OS?

    Here's the code: 

      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
            ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
            DeleteCommand="DELETE FROM [member] WHERE [member_id] = @original_member_id AND [fname] = @original_fname AND [lname] = @original_lname AND [website] = @original_website AND [notes] = @original_notes"
            InsertCommand="INSERT INTO [member] ([fname], [lname], [website], [notes]) VALUES (@fname, @lname, @website, @notes)"
            OldValuesParameterFormatString="original_{0}"
            SelectCommand="SELECT * FROM [member]"
            UpdateCommand="UPDATE [member] SET [fname] = @fname, [lname] = @lname, [website] = @website, [notes] = @notes WHERE [member_id] = @original_member_id AND [fname] = @original_fname AND [lname] = @original_lname AND [website] = @original_website AND [notes] = @original_notes">
                <DeleteParameters>
                    <asp:Parameter Name="original_member_id" Type="Int32" />
                    <asp:Parameter Name="original_fname" Type="String" />
                    <asp:Parameter Name="original_lname" Type="String" />
                    <asp:Parameter Name="original_website" Type="String" />
                    <asp:Parameter Name="original_notes" Type="String" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="fname" Type="String" />
                    <asp:Parameter Name="lname" Type="String" />
                    <asp:Parameter Name="website" Type="String" />
                    <asp:Parameter Name="notes" Type="String" />
                    <asp:Parameter Name="original_member_id" Type="Int32" />
                    <asp:Parameter Name="original_fname" Type="String" />
                    <asp:Parameter Name="original_lname" Type="String" />
                    <asp:Parameter Name="original_website" Type="String" />
                    <asp:Parameter Name="original_notes" Type="String" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="fname" Type="String" />
                    <asp:Parameter Name="lname" Type="String" />
                    <asp:Parameter Name="website" Type="String" />
                    <asp:Parameter Name="notes" Type="String" />
                </InsertParameters>
            </asp:SqlDataSource>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None">
                <Columns>
                    <asp:CommandField ShowEditButton="True" ShowDeleteButton="True" />
                    <asp:BoundField DataField="member_id" HeaderText="member_id" InsertVisible="False"
                        ReadOnly="True" SortExpression="member_id" />
                    <asp:BoundField DataField="fname" HeaderText="fname" SortExpression="fname" />
                    <asp:BoundField DataField="lname" HeaderText="lname" SortExpression="lname" />
                    <asp:BoundField DataField="website" HeaderText="website" SortExpression="website" />
                    <asp:BoundField DataField="notes" HeaderText="notes" SortExpression="notes" />
                </Columns>         
            </asp:GridView>


     

    Monday, October 15, 2007 7:38 AM

Answers

  • User-1136466523 posted

    Hi,

    From your description, it seems that you are unable to edit/delete the rows in GridView except for the first row, right?

    First, as for the indexing service, I don’t think it is the cause of the issue. Indexing Service is used to index documents and document properties on your disks and store the information in a catalog.

    In your case, I think one of the way is to watch the selected row’s index value in your RowUpdating event, also, watch for those variables such as original_member_id,  original_fname, original_lname and etc, try to check if they are correct.

    Besides, try to check if you have set anything in Page_Load, since when you are going to updating the row, postback occurs, maybe the parameter has be reset to the original status.

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 16, 2007 10:45 PM