Good evening! I have a ListView and I am displaying the values inside Span's, I would like to get the value of the span when clicking but as the Span's have the same ID I always get the same value.
Does anyone have any ideas how to get around this?
<script>
function controle(e) {
var outros = document.getElementById('ooooo').textContent;
alert(outros);
}
</script>
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<EmptyDataTemplate>
<table style="" runat="server">
<tr>
<td>Nenhum dado foi retornado.</td>
</tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<span class='fc-event' ID="ooooo" onclick="controle()"><%# Eval("Expr1") %></span>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table runat="server" id="itemPlaceholderContainer" style="" border="0">
<tr runat="server" id="itemPlaceholder"></tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="">
<asp:DataPager runat="server" ID="DataPager1" PageSize="25">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False"></asp:NextPreviousPagerField>
<asp:NumericPagerField></asp:NumericPagerField>
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False"></asp:NextPreviousPagerField>
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="">
<td>
</tr>
</SelectedItemTemplate>
</div>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString='<%$ ConnectionStrings:COEX_RPBConnectionString %>' SelectCommand="SELECT PROJETO + ' - ' + TITULO AS Expr1 FROM tbl_obras_projetos_final WHERE (STATUS_USUARIO = 'Execução')"></asp:SqlDataSource>