我有一个转发器,其中有文本框...现在我想当用户点击转发器中的锚链接然后得到文本框的值 [英] I have a repeater in which there is textbox ...now I want to when user click on anchor link in repeater then got the value of textbox
问题描述
< asp:Repeater ID =rptDestroyrunat =server>
< ItemTemplate>
< tr>
< td><%#Eval(productName)%>< / td>
< td><%#Eval(ProductId)%>< ; / td>
< td><%#Eval(Attid)%>< / td>
< td><%# Eval(vname)%>< / td>
< td><%#Eval(PendingQty)%>< / td>
< td>
< asp:TextBox ID =txtDestroyQtyCssClass =txtrunat =server>< / asp:TextBox>
< a href =javascript:Destroy('<%#Eval(vendorId)%>','<%#Eval(ProductId)%>','<%#Eval( Attid)%>')>销毁< / a>
< / td>
< / tr>
< / ItemTemplate>
< / asp:Repeater>
和我的jqery是
函数Destroy(vid,Pid,Attid){
var obj = {};
obj.vid = vid;
obj.pid = Pid;
obj.attid = Attid;
obj.pendingqty = pendingqty;
$ .ajax({
类型:POST,
url: /stocks/Rejection.aspx/DestroyItem,
数据:JSON.stringify(obj),
contentType:application / json; charset = utf-8,
dataType:json,
成功:功能(数据){
if(data.d ==Y)
window.location.href ='/ stocks / rejection.aspx';
else
提醒('未被摧毁');
},
错误:功能(结果){
提醒('出错');
}
});
}
我尝试过:
var value = $(this).closest ('td')。find(input [id * ='txtDestroyQty']);
var value = $(this).closest([id * ='rptDestroy']) .find(input [id * ='txtDestroyQty']);
alert(value);
.ajax({
类型:POST,
url:/ stocks / Rejection.aspx / DestroyItem,
数据:JSON.strin gify(obj),
contentType:application / json; charset = utf-8,
dataType:json,
成功:功能(数据){
if(data.d ==Y)
window.location.href ='/ stocks / rejection.aspx';
else
提醒('未被摧毁');
},
错误:功能(结果){
提醒('出错');
}
});
}
我尝试过:
var value =
(this).closest('td').find(\"input[id*='txtDestroyQty']);
var value =
(this).closest([id * ='rptDestroy'])。find(input [id * ='txtDestroyQty']);
alert(value);
<asp:Repeater ID="rptDestroy" runat="server" >
<ItemTemplate>
<tr>
<td><%#Eval("productName") %></td>
<td><%#Eval("ProductId") %></td>
<td><%#Eval("Attid") %></td>
<td><%#Eval("vname") %></td>
<td><%#Eval("PendingQty") %></td>
<td>
<asp:TextBox ID="txtDestroyQty" CssClass="txt" runat="server"></asp:TextBox>
<a href="javascript:Destroy('<%#Eval("vendorId") %>','<%#Eval("ProductId") %>','<%#Eval("Attid") %>')">Destroy</a>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
and my jqery is
function Destroy(vid, Pid, Attid) {
var obj = {};
obj.vid = vid;
obj.pid = Pid;
obj.attid = Attid;
obj.pendingqty = pendingqty;
$.ajax({
type: "POST",
url: "/stocks/Rejection.aspx/DestroyItem",
data: JSON.stringify(obj),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if (data.d == "Y")
window.location.href = '/stocks/rejection.aspx';
else
alert('Not Destroyed');
},
error: function (result) {
alert('went wrong');
}
});
}
What I have tried:
var value = $(this).closest('td').find("input[id*='txtDestroyQty']");
var value = $(this).closest("[id*='rptDestroy']").find("input[id*='txtDestroyQty']");
alert(value);
.ajax({
type: "POST",
url: "/stocks/Rejection.aspx/DestroyItem",
data: JSON.stringify(obj),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if (data.d == "Y")
window.location.href = '/stocks/rejection.aspx';
else
alert('Not Destroyed');
},
error: function (result) {
alert('went wrong');
}
});
}
What I have tried:
var value =
(this).closest('td').find("input[id*='txtDestroyQty']");
var value =
(this).closest("[id*='rptDestroy']").find("input[id*='txtDestroyQty']");
alert(value);
这篇关于我有一个转发器,其中有文本框...现在我想当用户点击转发器中的锚链接然后得到文本框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!