r k

r k

  • NA
  • 111
  • 16.7k

Repeater control each row id on button click

Apr 24 2021 11:07 PM
I have a repeater control and I want it's row id when user click button "Read Message" which is a hidden field with the javascript or jquery. But whichever row i am selecting , i am getting the last row ID . Please help 
i have my repeater control below :
<asp:HiddenField ID="hdnId" runat="server" Value='<%# Bind("ID") %>' />
<h4><%#Eval("SubjectText") %></h4>
<div>
<input type="button" id="btn" class="btn btn-default" value="Read Message" onclick="DeleteRecord();return false">
</div>
<div id="Create" style="display: none">
<div class="cnt" style="overflow: hidden">
<p class="show-read-more"><%#Eval("MessageText") %></p>
</div>
</div>
 
My jquery:
function DeleteRecord() {
event.preventDefault();
var name = "<%: HttpContext.Current.User.Identity.Name %>";
//Jquery ajax call to server side method
var msg = "";
var row = $(this).closest("tr");
var hidId = $('[id*=hdnId]').val();
 
 
 
 

Answers (2)