Wednesday, 2 October 2013

Get text value of span in repeater by using javascript or jquery

Get text value of span in repeater by using javascript or jquery

i can't get value of span (or label) here is my html code
<asp:Repeater ID="rpt_district" runat="server" >
<ItemTemplate>
<tbody id='bodies'>
<tr>
<td>
<span id="district_id"><%# Eval("DISTRICT_ID") %></span>
</td>
<td><%# Eval("DISTRICT_NAME") %></td>
<td>
<asp:Label ID="lb_city_id" runat="server" Text='<%#
Eval("CITY_ID") %>'></asp:Label>
</td>
<td style="float:left; margin-left:5px;">
<asp:CheckBox ID="cb_status" runat="server"
onclick="javascript: return false;" />
<asp:HiddenField ID="hf_status" Value='<%#
Eval("ENABLE") %>' runat="server" />
</td>
<td>
<div style="float:left; margin-left:4px;" >
<asp:ImageButton ID="ib_edit" runat="server"
ImageUrl="~/Hinh/icons/Edit.png" ToolTip="Edit" />
</div>
<div style="float:left; margin-left:4px;">
<asp:ImageButton ID="ib_delete" runat="server"
ImageUrl="~/Hinh/icons/Trash.png"
ToolTip="Delete"
CommandArgument='<%#
Eval("DISTRICT_ID") %>'
OnClientClick="getvalue(); return
false;"/>
</div>
</td>
</tr>
</tbody>
</ItemTemplate>
</asp:Repeater>
i want to get value of district_id in span tag (or label is ok) by using
javascript when clicking on imagebutton
function getvalue() {
var thisspan = $('.district_id').eq(0);
alert(thisspan);
}
but it just get the value in first column be cause of ea(0) i'm just want
to get value by using javascript or jquery not code behind thanks.....

No comments:

Post a Comment