Hi all I have grid with a checkbox column and made disabled. and a column with image button, when I click the image button, the corresponding check value of the checkbox in the row should be fetched.
This is my grid,
<asp:TemplateField HeaderText="Status" ItemStyle-Width="10%">
<ItemTemplate>
<asp:CheckBox ID="chkStatus" runat="server" Checked='<%# Eval("Deleted") %>' Text="InActive" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Options" ItemStyle-Width="10%">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" CommandName="Edit" ImageUrl="images/Edit.gif"
OnClick='<%# Eval("ID", "ShowEditBox({0});return false;") %>' runat="server"
ToolTip="Edit" />
<asp:ImageButton ID="imgDelete" CommandName="Delete" ImageUrl="images/Delete.gif"
OnClientClick='<%# Eval("ID", "DeleteRecord({0});return false;") %>' runat="server"
ToolTip="Active/InActive" />
</ItemTemplate>
</asp:TemplateField>
Below is the Jquery method,
function ShowEditBox(id)
{
$("#divEditBox").slideDown("medium");
var pid = 'PName' + id;
var colIndex = 0;
var $tr = $("#" + pid).parent().parent();
$tr.find('td').each(function() {
if (colIndex == 1) {
$("#txtGroupName").val($(this).text());
}
if (colIndex == 2) {
if (this.checked) { alert("true"); } else { alert("false"); }
//
// alert($('#' + '<%= chkStatus.ClientID %>').is(':checked'));
// alert($(this).text());
}
colIndex++;
})
$("#editId").val(id);
$("#lblPopTitle").text("Modify Group");
}
when i click the edit button the showedit() jquery method always return the checkbox value as false.
anybody please help me on this….
thanks
Your
thiskeyword inthis.checkedis thetdin your.eachfunction.You first have to find the checkbox. Do something like :