1
I have a asp:Repeater
and need to recover in javascript the ID of the item referring to the record displayed in asp:Repeater
.
Take a look at mine 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 one asp:HiddenField
which stores the ID.
What I need is to get this one back ID to move to the function javascript down 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?
You use
MasterPage
?– Jothaz
@Jay I use yes.
– Leonardo Ribeiro de Aguiar