Reputation: 127
<table>
<tr style="background-color: aqua">
<td>Malzeme No</td>
<td>Malzeme Adı</td>
</tr>
<asp:Repeater ID="rptMalzemeList" runat="server">
<ItemTemplate>
<tr class="malzlist">
<td><%#Eval("MATNR") %></td>
<td><%#Eval("MAKTX") %></td> // I want this value
<td><a href="#" id="btnSec" onclick="sendValue(this)">Seç</a></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
My JavaScript function like this,
function sendValue(objs)
{
var MalzName = objs.parent().parent().children().next().text();
alert(MalzName);
window.opener.HandlePopupResult(MalzName);
window.close();
}
but, it is given error undefined is a not function.Can you help me please?
Upvotes: 0
Views: 88
Reputation: 24638
You may want to avoid inline JS and use the following:
HTML:
<td><a href="#" id="btnSec">Seç</a></td>
JS
$(function() {
$('#btnSec').on('click',function() {
var MalzName = $(this).parent().prev().text();
alert(MalzName);
window.opener.HandlePopupResult(MalzName);
window.close();
});
});
OR:
$(function() {
$('#btnSec').on('click', sendValue);
});
function sendValue()
{
var MalzName = $(this).parent().prev().text();
alert(MalzName);
window.opener.HandlePopupResult(MalzName);
window.close();
}
Upvotes: 0
Reputation: 207913
Change:
var MalzName = objs.parent().parent().children().next().text();
to:
var MalzName = $(objs).parent().prev().text();
Upvotes: 2
Reputation: 137432
objs
is a DOM Element, not a jQuery wrapper. The first line of your function should convert it:
objs = $(objs);
Then you have a shot at it working. Not commenting on the other aspects of the function at this moment.
Upvotes: 0