Return to Snippet

Revision: 70430
at February 11, 2016 12:07 by systemergon


Initial Code
VISTA DISEÑO

<asp:GridView runat="server" ID="GvVentas" DataKeyNames="ID" OnRowUpdating="GvVentas_RowUpdating"
            OnSelectedIndexChanging ="GvVentas_SelectedIndexChanging" OnRowEditing ="GvVentas_RowEditing" AutoGenerateColumns="False" OnRowCancelingEdit="GvVentas_RowCancelingEdit">
         
            <Columns>
            <asp:CommandField HeaderText="Edit-Update" ShowEditButton="True" />
            <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="true" />
              <asp:BoundField DataField="TIE" HeaderText="TIE" ReadOnly="true"/>
                <asp:BoundField DataField="CREDITO" HeaderText="CREDITO" ReadOnly="true" />
                  <asp:BoundField DataField="CONTADO" HeaderText="CONTADO" ReadOnly="true" />
                    <asp:BoundField DataField="TOTAL" HeaderText="TOTAL" ReadOnly="true" />
         
                     <asp:TemplateField HeaderText="FCH" SortExpression="FCH">
                <ItemTemplate>
                        <asp:Label ID="LBFch" runat="server" Text='<%# Bind("FCH") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TXTFch" runat="server" Text='<%# Bind("FCH") %>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                      

            
            </Columns>
            <RowStyle BackColor="#E3EAEB" />          
        </asp:GridView>


-------- CODIGO SERVIDOR -------

 'Opcion Seleccionada
    Protected Sub GvVentas_SelectedIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GvVentas.SelectedIndexChanging
        Dim editID As Integer
        editID = Convert.ToInt32(GvVentas.DataKeys(e.NewSelectedIndex).Value)
    End Sub

Initial URL

                                

Initial Description
Como podemos obtener la selección del GridView, debemos declarar DataKeyName

Initial Title
Obtener opción seleccionada de GridView

Initial Tags

                                

Initial Language
VB.NET