0

Im working using Gridview and Sqldatasource, so , when Im tried to use the updatecommand, but when I clicked on, nothing happen, so, if I save a new record and after click on update command button , so , it works well. do you have any idea about whats happening ? the next is my code snipped

         <asp:GridView  ID="gvInfoCobradores" runat="server" CellPadding="4" 
             ForeColor="#333333" GridLines="None" AutoGenerateEditButton="True" 
             OnRowEditing="gvInfoAdmin_RowEditing" OnRowUpdating="gvInfoAdmin_RowUpdating" 
             DataSourceID="dsCobradorInfo" DataKeyNames="ID_Cobrador" Width="50%">
        <AlternatingRowStyle BackColor="White" />
             <Columns>
                 <asp:CommandField ShowDeleteButton="True" />
             </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />



    </asp:GridView>


        <asp:SqlDataSource ID="dsCobradorInfo" runat="server" ConnectionString="<%$ ConnectionStrings:SeminarioConnectionString %>" 
        SelectCommand="SELECT * FROM [UsuariosSistema].[Cobrador]" 
        OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues" 
        DeleteCommand="DELETE FROM [UsuariosSistema].[Cobrador] WHERE [ID_Cobrador] = @original_ID_Cobrador AND [NombreUsuarioCobrador] = @original_NombreUsuarioCobrador AND [PasswordCobrador] = @original_PasswordCobrador AND [NombreCobrador] = @original_NombreCobrador AND [ApellidoPaternoCobrador] = @original_ApellidoPaternoCobrador AND [ApellidoMaternoCobrador] = @original_ApellidoMaternoCobrador AND (([TelCobrador] = @original_TelCobrador) OR ([TelCobrador] IS NULL AND @original_TelCobrador IS NULL)) AND (([CelCobrador] = @original_CelCobrador) OR ([CelCobrador] IS NULL AND @original_CelCobrador IS NULL)) AND (([CorreElectronicoCobrador] = @original_CorreElectronicoCobrador) OR ([CorreElectronicoCobrador] IS NULL AND @original_CorreElectronicoCobrador IS NULL))" 
        InsertCommand="INSERT INTO [UsuariosSistema].[Cobrador] ([NombreUsuarioCobrador], [PasswordCobrador], [NombreCobrador], [ApellidoPaternoCobrador], [ApellidoMaternoCobrador], [TelCobrador], [CelCobrador], [CorreElectronicoCobrador]) VALUES (@NombreUsuarioCobrador, @PasswordCobrador, @NombreCobrador, @ApellidoPaternoCobrador, @ApellidoMaternoCobrador, @TelCobrador, @CelCobrador, @CorreElectronicoCobrador)" 

             UpdateCommand="UPDATE [UsuariosSistema].[Cobrador] SET [NombreUsuarioCobrador] = @NombreUsuarioCobrador, [PasswordCobrador] = @PasswordCobrador, [NombreCobrador] = @NombreCobrador, [ApellidoPaternoCobrador] = @ApellidoPaternoCobrador, [ApellidoMaternoCobrador] = @ApellidoMaternoCobrador, [TelCobrador] = @TelCobrador, [CelCobrador] = @CelCobrador, [CorreElectronicoCobrador] = @CorreElectronicoCobrador WHERE [ID_Cobrador] = @original_ID_Cobrador AND [NombreUsuarioCobrador] = @original_NombreUsuarioCobrador AND [PasswordCobrador] = @original_PasswordCobrador AND [NombreCobrador] = @original_NombreCobrador AND [ApellidoPaternoCobrador] = @original_ApellidoPaternoCobrador AND [ApellidoMaternoCobrador] = @original_ApellidoMaternoCobrador AND (([TelCobrador] = @original_TelCobrador) OR ([TelCobrador] IS NULL AND @original_TelCobrador IS NULL)) AND (([CelCobrador] = @original_CelCobrador) OR ([CelCobrador] IS NULL AND @original_CelCobrador IS NULL)) AND (([CorreElectronicoCobrador] = @original_CorreElectronicoCobrador) OR ([CorreElectronicoCobrador] IS NULL AND @original_CorreElectronicoCobrador IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_ID_Cobrador" Type="Int32" />
            <asp:Parameter Name="original_NombreUsuarioCobrador" Type="String" />
            <asp:Parameter Name="original_PasswordCobrador" Type="String" />
            <asp:Parameter Name="original_NombreCobrador" Type="String" />
            <asp:Parameter Name="original_ApellidoPaternoCobrador" Type="String" />
            <asp:Parameter Name="original_ApellidoMaternoCobrador" Type="String" />
            <asp:Parameter Name="original_TelCobrador" Type="String" />
            <asp:Parameter Name="original_CelCobrador" Type="String" />
            <asp:Parameter Name="original_CorreElectronicoCobrador" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="NombreUsuarioCobrador" Type="String" />
            <asp:Parameter Name="PasswordCobrador" Type="String" />
            <asp:Parameter Name="NombreCobrador" Type="String" />
            <asp:Parameter Name="ApellidoPaternoCobrador" Type="String" />
            <asp:Parameter Name="ApellidoMaternoCobrador" Type="String" />
            <asp:Parameter Name="TelCobrador" Type="String" />
            <asp:Parameter Name="CelCobrador" Type="String" />
            <asp:Parameter Name="CorreElectronicoCobrador" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="NombreUsuarioCobrador" Type="String" />
            <asp:Parameter Name="PasswordCobrador" Type="String" />
            <asp:Parameter Name="NombreCobrador" Type="String" />
            <asp:Parameter Name="ApellidoPaternoCobrador" Type="String" />
            <asp:Parameter Name="ApellidoMaternoCobrador" Type="String" />
            <asp:Parameter Name="TelCobrador" Type="String" />
            <asp:Parameter Name="CelCobrador" Type="String" />
            <asp:Parameter Name="CorreElectronicoCobrador" Type="String" />
            <asp:Parameter Name="original_ID_Cobrador" Type="Int32" />
            <asp:Parameter Name="original_NombreUsuarioCobrador" Type="String" />
            <asp:Parameter Name="original_PasswordCobrador" Type="String" />
            <asp:Parameter Name="original_NombreCobrador" Type="String" />
            <asp:Parameter Name="original_ApellidoPaternoCobrador" Type="String" />
            <asp:Parameter Name="original_ApellidoMaternoCobrador" Type="String" />
            <asp:Parameter Name="original_TelCobrador" Type="String" />
            <asp:Parameter Name="original_CelCobrador" Type="String" />
            <asp:Parameter Name="original_CorreElectronicoCobrador" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>

Thanks in advance!!

2
  • Check the SQL profiler to see if anything is trying to execute and contains problem Commented Dec 7, 2012 at 7:07
  • Im noticed that when I cliked on updatecommand the first time, it doesnt execute the gvInfoAdmin_RowUpdating method in code behind, but after to save one record, its executed everytime. Im deleted the gridview and sqldatasource, and recreate those, but it works equal... Commented Dec 7, 2012 at 7:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.