I have the following Jquery function
<script type='text/javascript'>
$(function () {
var msgbox = $("#status");
$( '<%= txtCurrBlk.ClientID %>').on('keyup', function () {
alert("The paragraph was clicked.");
$.ajax({
type: "POST",
url: "MonthlyCopyReadings.aspx/readingTextChanged",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
msgbox.html(msg.d);
}
});
});
});
txtCurrBlk is from the following block of code
<asp:Repeater runat="server" ID="rptMeterReads" >
<ItemTemplate>
<tr>
<td><%#Eval("serialNum") %></td>
<td style="display:none"><asp:Label ID="lblMfdId" runat="server" Text='<%#Eval("mfdId") %>'/></td>
<td><%#Eval("contractNum") %></td>
<td><%#Eval("model") %></td>
<td><asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%#Eval("ipAddress") %>'><%#Eval("ipAddress") %></asp:HyperLink></td>
<td><%#Eval("password") %></td>
<td><asp:Label ID="lblPrevBlk" runat="server" Text='<%#Eval("previousBlack") %>' /></td>
<td><asp:TextBox ID="txtCurrBlk" runat="server" style="width:80px" Text='<%#Eval("currentBlack") %>' AutoPostBack="true" /></td>
<td><asp:Label ID="lblTotalBlk" runat="server" /> </td>
<td><asp:Label ID="lblPrevClr" runat="server" Text='<%#Eval("previousColour") %>' /></td>
<td><asp:TextBox ID="txtCurrClr" runat="server" style="width:80px" Text='<%#Eval("currentColour") %>' Autopostback="true" /></td>
<td><asp:Label ID="lblTotalClr" runat="server" /> </td>
<%--<td><asp:CheckBox ID="isColor" Checked='<%#Eval("") %>' runat="server" ReadOnly="True"/></td>--%>
</tr>
</ItemTemplate>
</asp:Repeater>
I have found that I get "txtCurrBlack does not exist in its current context" if I have it inside the itemTemplate. Is there a way I can reference that textbox correctly?