Unwanted behavior when editing a row in a grid

0

I have a asp:GridView paged with datatables . The point is that when I give it to edit, although I keep the page in which I am correctly, the row that I edit becomes the last one of the table in the last of the pages. It's obvious that I need to keep that row where it is.

To edit the row, the only thing I do is to mark the editindex and then I call back the function that binders me the grid.

Edit row

Protected Sub gvConfApp_RowEditing(sender As Object, e As GridViewEditEventArgs)
    gvConfApp.EditIndex = e.NewEditIndex
    Me.pmCargarGrid()
    gvConfApp.FooterRow.Visible = False
End Sub

Grid

<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:GridView runat="server" ID="gvConfApp" AutoGenerateColumns="false" CssClass="table table-hover table-striped no-more-tables sorting" ShowFooter="true" OnRowEditing="gvConfApp_RowEditing">
            <HeaderStyle CssClass="th-inner" />
            <Columns>
                <%-- NIF --%>
                <%--<asp:BoundField DataField="NifCluster" meta:resourcekey="lblNIF" />--%>
                <asp:TemplateField AccessibleHeaderText="NIF" HeaderText="NIF" ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                    <ItemTemplate>                                                                                                                        
                        <asp:Label runat="server" ID="NifCluster_lbl" Text='<%# Eval("NifCluster")%>'></asp:Label>                                
                    </ItemTemplate>
                    <EditItemTemplate>
                        <div class="controls-inline">
                            <input id="NifCluster_txtBox" value='<%# Eval("NifCluster")%>' runat="server" class="form-control" type="text" name="NifCluster_txtBox" 
                                maxlength="20" data-bv-notempty="true" data-bv-notempty-message="<%$ Resources: Errores, CampoObligatorio %>" required="required" />
                        </div>
                        <%--<asp:TextBox runat="server" ID="NifCluster_txtBox" Text='<%# Eval("NifCluster")%>' data-bv-notempty-message="<%$ Resources: Errores, CampoObligatorio %>"></asp:TextBox>--%>
                    </EditItemTemplate>                                    
                    <FooterTemplate>                                        
                        <div class="controls-inline">
                            <input id="NifCluster_F_txtBox" runat="server" class="form-control" type="text" name="NifCluster_txtBox" 
                                maxlength="20" data-bv-notempty="true" data-bv-notempty-message="<%$ Resources: Errores, CampoObligatorio %>" required="required" />
                        </div>
                    </FooterTemplate>
                </asp:TemplateField>
                <%-- Nombre --%>
                <%--<asp:BoundField DataField="NomApeCluster" meta:resourcekey="lblNombre" />--%> 
                <asp:TemplateField AccessibleHeaderText="Nombre" HeaderText="Nombre" ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                    <ItemTemplate>                                                                                                                        
                        <asp:Label runat="server" ID="NomApeCluster_lbl" Text='<%# Eval("NomApeCluster")%>'></asp:Label>                                
                    </ItemTemplate>
                    <EditItemTemplate>
                        <input id="NomApeCluster_txtBox" value='<%# Eval("NomApeCluster")%>' runat="server" class="form-control" type="text" name="NomApeCluster_txtBox" 
                            maxlength="500" data-bv-notempty="true" data-bv-notempty-message="<%$ Resources: Errores, CampoObligatorio %>" required="required" />
                        <%--<asp:TextBox runat="server" ID="NomApeCluster_txtBox" Text='<%# Eval("NomApeCluster")%>' data-bv-notempty-message="<%$ Resources: Errores, CampoObligatorio %>"></asp:TextBox>--%>
                    </EditItemTemplate>
                    <FooterTemplate>
                        <input id="NomApeCluster_F_txtBox" runat="server" class="form-control" type="text" name="NomApeCluster_txtBox" 
                            maxlength="500" data-bv-notempty="true" data-bv-notempty-message="<%$ Resources: Errores, CampoObligatorio %>" required="required" />
                    </FooterTemplate>
                </asp:TemplateField>                                            
                <%-- Botones --%>
                <asp:TemplateField ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <div class="btn-group dropdown">
                            <button class="btn btn-default dropdown-toggle" aria-expanded="false" aria-haspopup="true" data-toggle="dropdown" type="button">
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" style="right: 0px; left: auto;">
                                <%-- Modificar Grid --%>
                                <li>
                                    <asp:LinkButton Text="Edit" runat="server" CommandName="Edit" OnClick="OnEdit">
                                        <i class="glyphicon glyphicon-edit iconoTabla"></i>
                                        <span><%=Resources.Controles.Modificar %></span>
                                    </asp:LinkButton>
                                </li>
                                <%-- Eliminar Grid --%>
                                <li>
                                    <asp:LinkButton Text="Delete" runat="server" OnClick="OnDelete">
                                        <i class="glyphicon glyphicon-trash iconoTabla"></i>
                                        <span><%=Resources.Controles.Eliminar %></span>
                                    </asp:LinkButton>
                                </li>
                            </ul>
                        </div>                                
                    </ItemTemplate>
                    <EditItemTemplate>
                        <div class="btn-group dropdown">
                            <button class="btn btn-default dropdown-toggle" aria-expanded="false" aria-haspopup="true" data-toggle="dropdown" type="button">
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" style="right: 0px; left: auto;vertical-align: middle;">
                                <%-- GuardarDatos Grid --%>
                                <li>
                                    <%--<asp:Button type="button" id="btnNuevaCluster" runat="server" onserverclick="OnUpdate">
                                        <span class="glyphicon glyphicon-ok iconoTabla"></span><%=Resources.Controles.GuardarDatos %>
                                    </asp:Button>--%>

                                    <%--<asp:Button runat="server" ID="btnNuevaCluster" class="btn btn-primary" meta:resourcekey="btnNuevaCluster"></asp:Button>--%>

                                    <asp:LinkButton Text="Update" runat="server" OnClick="OnUpdate">
                                        <i class="glyphicon glyphicon-ok iconoTabla" style="display:inline;vertical-align:middle;"></i>
                                        <span style="display:inline;vertical-align:middle;"><%=Resources.Controles.GuardarDatos %></span>
                                    </asp:LinkButton>
                                </li>
                                <%-- Limpiar Grid --%>
                                <li>
                                    <asp:LinkButton Text="Cancel" runat="server" OnClick="OnClean">
                                        <i class="glyphicon glyphicon-triangle-left iconoTabla" style="display:inline;vertical-align:middle;"></i>
                                        <span style="display:inline;vertical-align:middle;"><%=Resources.Controles.Limpiar %></span>
                                    </asp:LinkButton>
                                </li>
                                <%-- Cancelar Grid --%>
                                <li>
                                    <asp:LinkButton Text="Cancel" runat="server" OnClick="OnCancel">
                                        <i class="glyphicon glyphicon-remove iconoTabla" style="display:inline;vertical-align:middle;"></i>
                                        <span style="display:inline;vertical-align:middle;"><%=Resources.Controles.Cancelar %></span>
                                    </asp:LinkButton>
                                </li>
                            </ul>
                        </div>                                                                
                    </EditItemTemplate>
                    <FooterTemplate>
                        <div class="btn-group dropdown">
                            <button class="btn btn-default dropdown-toggle" aria-expanded="false" aria-haspopup="true" data-toggle="dropdown" type="button">
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" style="right: 0px; left: auto;vertical-align: middle;">
                                <%-- GuardarDatos Grid --%>
                                <li>
                                    <%--<asp:Button type="button" id="btnNuevaCluster" runat="server" onserverclick="OnUpdate">
                                        <span class="glyphicon glyphicon-ok iconoTabla"></span><%=Resources.Controles.GuardarDatos %>
                                    </asp:Button>--%>

                                    <%--<asp:Button runat="server" ID="btnNuevaCluster" class="btn btn-primary" meta:resourcekey="btnNuevaCluster"></asp:Button>--%>

                                    <asp:LinkButton Text="Update" runat="server" OnClick="OnUpdate">
                                        <i class="glyphicon glyphicon-ok iconoTabla" style="display:inline;vertical-align:middle;"></i>
                                        <span style="display:inline;vertical-align:middle;"><%=Resources.Controles.GuardarDatos %></span>
                                    </asp:LinkButton>
                                </li>
                                <%-- Limpiar Grid --%>
                                <li>
                                    <asp:LinkButton Text="Cancel" runat="server" OnClick="OnClean">
                                        <i class="glyphicon glyphicon-triangle-left iconoTabla" style="display:inline;vertical-align:middle;"></i>
                                        <span style="display:inline;vertical-align:middle;"><%=Resources.Controles.Limpiar %></span>
                                    </asp:LinkButton>
                                </li>
                                <%-- Cancelar Grid --%>
                                <li>
                                    <asp:LinkButton Text="Cancel" runat="server" OnClick="OnCancel">
                                        <i class="glyphicon glyphicon-remove iconoTabla" style="display:inline;vertical-align:middle;"></i>
                                        <span style="display:inline;vertical-align:middle;"><%=Resources.Controles.Cancelar %></span>
                                    </asp:LinkButton>
                                </li>
                            </ul>
                        </div> 
                    </FooterTemplate>
                </asp:TemplateField>
            </Columns>                                      
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>
    
asked by GDP 18.04.2018 в 10:41
source

0 answers