Please find below my grid view :
CellPadding="4" ShowFooter="True"
DataKeyNames="TimesheetId" Width="700px"
onsorting="ExpensesGridView_Sorting" CssClass="Gvplacement">
Approve:
CommandName="Approve" />
As I am new to jquery,I am not able to get the buttonId.
I have to create a jquery function which will be called when we click the image button.
Purpose of the function:
Check if any check box is selected and if so , an alert message has to be displayed.

Iftikar HussainRank #423 · 5.9K reputationPosted Jul 4, 2013, 2:29 AM EDT
You can do this by like below
Modify the ImageButton to call javascript method
Regards,
Iftikar
Resmi Satish112 reputationPosted Jul 4, 2013, 3:33 AM EDT
Now I am able to check whether check box are selected or not.
I have to find the sum of label controls for which the check box are selected .
I tried using .each function but some error was throwing.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 4, 2013, 3:39 AM EDT
Regards,
Iftikar
Resmi Satish112 reputationPosted Jul 4, 2013, 3:56 AM EDT
function fReceiptExists() {
var totalreceiptcount;
var len = $("input:checkbox:checked").length;
if (len == 0) {
alert("Please select any timesheet for approval");
return false;
}
else {
$('#<%=ExpensesGridView.ClientID%>').each(function() {
if ($(this).find('input:checkbox').attr("checked")) {
alert('inseide');
totalreceiptcount += parseInt($(this).find('input:text[id$="lblReceiptCount"]').attr("value"));
alert(totalreceiptcount);
}
});
return true;
}
}
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 4, 2013, 4:16 AM EDT
Modify your javascript as shown below
and in your grid
Regards,
Iftikar
Resmi Satish112 reputationPosted Jul 9, 2013, 1:59 AM EDT
Note:
appBtn is the css class name assigned to the button
Gvplacement is the css class name assigned to the gridview.