我有一个gridview如下:
<asp:GridView ID="gvSentDate" runat="server">
<Columns>
<asp:BoundField DataField="NumberWithText" HeaderText="Number" ReadOnly="true" />
<asp:BoundField DataField="NumberWithMask" HeaderText="Number"
ReadOnly="true" />
</Columns>
</asp:GridView>
每当用户单击该行时,我都想获取 NumberWithText 的文本。我有以下按列获取的 jquery,但是当用户单击整行时,我只想获取该列:
$(document).ready(function () {
$("#<%=gvSentDate.ClientID%> tr:has(td)").hover(function (e) {
$(this).css("cursor", "pointer");
});
$("#<%=gvSentDate.ClientID%> tr:has(td)").click(function (e) {
var selTD = $(e.target).closest("tr");
alert(selTD.text());
});
});