I have a asp:Repeater
and need to retrieve in javascript the ID of the item referring to the record displayed in asp:Repeater
.
See how my asp:Repeater
<asp:Repeater ID="rpt" runat="server" OnItemDataBound="rpt_OnItemDataBound">
<ItemTemplate>
<div id="div" runat="server" style="margin: 5px 0 5px 0; min-height: 10px;
padding-bottom: 10px; width: 100%">
<div style="width: 40%; float: left; position: relative">
<asp:HiddenField runat="server" ID="hdnID" Value='<%# Eval(" ID ") %>' />
<asp:Label runat="server" ID="lblNome" Text='<%# Eval(" Nome ") %>' />
</div>
<div style="width: 30%; float: left; position: relative">
<asp:TextBox runat="server" ID="txtData" ReadOnly="True" CssClass="Data" />
</div>
<div style="width: 30%; float: left; position: relative">
<asp:LinkButton runat="server" ID="btnInformacoes" Text="Informações" Visible="False" />
</div>
</div>
<div class="linha1">
</div>
</ItemTemplate>
</asp:Repeater>
See that I have a asp:HiddenField
that stores the ID .
What I need is to retrieve this ID to move to the javascript function below.
$.ajax
({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "listas.aspx/Listar",
data: "{'id':'" + "58" + "'}", // nesta linha, no lugar do 58, quero passar o ID que esta no meu asp:Repeater.
dataType: "json",
success: function (data) {
alert('Sucesso');
},
error: function (result) {
alert('Erro');
}
});
Does anyone have any idea how I can do this?