I want to get the information of a selected row of ListView
to pass them to an object with the same (and other more) fields.
I tried with SelectedItemTemplate (since SelectedItems does not appear to me) but I can not index it (or index it?) Because it does not leave me.
I need to do something like this:
obj.codigo = LitView.SelectedItem[0].toString();
obj.nombre = LitView.SelectedItem[1].toString();
Where [0] would be the code of the selected element, [1] the name of the same, ect.
If it works, here is the ListView code:
'
<GroupTemplate>
<tr runat="server">
<td id="itemPlaceholder" runat="server"></td>
</tr>
</GroupTemplate>
<LayoutTemplate>
<table>
<td runat="server" id="groupPlaceholder"></td>
</table>
</LayoutTemplate>
<ItemTemplate>
<td class="align text-center">
<br />
<asp:Label ID="codArt" runat="server" Text='<%# Eval("CodArticulo_A") %>' Visible="false" />
<asp:ImageButton ID="ImageButton1" ImageUrl='<%# Eval("Imagen_A") %>' runat="server" CommandName="eventoImageButton1" OnCommand="ImageButton1_Command" />
<br />
<asp:Label ID="nombreLibro" runat="server" Text='<%# Eval("Nombre_A") %>' />
<br />
<asp:Label ID="nombreAutor" runat="server" Text='<%# Eval("NombreAutor") %>' />
<br />
$
<asp:Label ID="Precio" runat="server" Text='<%# Eval("PrecioUnitario_A") %>' />
<br />
<asp:Button ID="addCarrito" runat="server" CssClass="btn" CommandArgument='<%# Eval("Nombre_A") %>' Text="Agregar al carrito" OnCommand="addCarrito_Command" />
</td>
</ItemTemplate>
</asp:ListView>'