Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
#grdTimeReport grid should get disabled when clicking on approve button.

It was working fine in IE but not in chrome.

What I have tried:

function OnchangeStatus()
{
debugger;
var YearFromPage = $("#selYear").val();
var MonthFromPage = $("#selMonth").val();
var EmployeeID = $("#hdnusrTableId").val();
var status = $("#selStatus").val();
var id = statusID;
if (status == "2") {
$('#grdTimeReport').prop('disabled', true);
timesheetStatus = "Approved";
$("#statusLabel").css("color", "Green");
$("#statusLabel").text(timesheetStatus);
$.ajax({
contentType: 'application/json',
type: 'POST',
dataType: "json",
data: JSON.stringify({ "Id": id, "EmpId": EmployeeID, "year": YearFromPage, "month": MonthFromPage, "status": timesheetStatus }),
url: timesheetStatusUpdateUrl,
success: function (data) {
//debugger;
hideModificationOption();
window.alert("Status updated successfully");
},
error: function (error, errostatus, er) { debugger; }
});
}
else {
$('#grdTimeReport').prop('disabled', false);
timesheetStatus = "Denied";
$("#statusLabel").css("color", "Red");
$("#statusLabel").text(timesheetStatus);
$.ajax({
contentType: 'application/json',
type: 'POST',
dataType: "json",
data: JSON.stringify({ "Id": id, "EmpId": EmployeeID, "year": YearFromPage, "month": MonthFromPage, "status": timesheetStatus }),
url: timesheetStatusUpdateUrl,
success: function (data) {
window.alert("Status updated successfully");
},
error: function (error, errostatus, er) { debugger;}
});
}

}
Posted
Updated 16-Jan-18 20:35pm
Comments
F-ES Sitecore 11-Jan-18 7:58am    
Do you have more than one element with an id of grdTimeReport?
Arav_Manoj 11-Jan-18 22:28pm    
No..if it is so it shud not worked on IE too ryt?
Karthik_Mahalingam 11-Jan-18 8:53am    
are you getting any error in chrome console window?
Arav_Manoj 11-Jan-18 23:17pm    
Nope
Karthik_Mahalingam 12-Jan-18 0:23am    
try that particular query in console.

1 solution

per comments, you are trying to disable a div

check this thread to disable the controls present in the div
jquery - Enable & Disable a Div and its elements in Javascript - Stack Overflow[^]
 
Share this answer
 
Comments
Arav_Manoj 12-Jan-18 5:00am    
Getting console error in chrome:

Uncaught TypeError: Cannot read property 'inline' of undefined
at HTMLDivElement.<anonymous> (jquery-ui-1.8.20.js:8754)
at HTMLDivElement.dispatch (jquery-1.7.1.js:3256)
at HTMLDivElement.eventHandle (jquery-1.7.1.js:2875)
Karthik_Mahalingam 12-Jan-18 5:03am    
did you try these
// This will disable just the div
$("#grdtimereport").prop('disabled',true);
or

// This will disable everything contained in the div
$("#grdtimereport").children().prop('disabled',true);
or

// disable ALL descendants of the DIV
$("#grdtimereport *").prop('disabled',true);
Arav_Manoj 12-Jan-18 5:12am    
Tried all the 3 still it was not getting reflected anything in chrome.
Karthik_Mahalingam 12-Jan-18 5:17am    
can you post the content of div markup
Arav_Manoj 12-Jan-18 5:23am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900