I have a Telerik Grid , in an ascx page,the first cloumn of the grid is a checkbox and i have written some jquery function on button click to
get the checkbox id and one more colum form the grid as status. and based on status i am pering some valdation using Jquery.
the Jquery 1.5.1 version
Telerik Grid version 2011.2.712.40
But this works perfectly fine in my local and on iis server. But i have deployed the application in Microsoft Azure cloud and it does not work over there.
I have realised that when i have added my setting as Trusted sites in internet explorer it started working. But this can be only a work around.
Could you please tell me will there be any problem if it is a non trusted site. hOw to fix the proble.
Please find below the code for your refernce. This is very urgent and imp to us.Kindly require your support.
//Function on click of Publish button
$(document).ready(
function (event) {
$(
'#publish').click(function () {
debugger;
//Hide the message when clicked on any button.
document.getElementById(
'validationmessage').style.display = "none";
var CanPublish = false;
var $checkedRecords = $('#CommitmentTemplateDetailsGrid').find(':checked');
if ($checkedRecords.length == 0) {
document.getElementById(
'validationmessage').style.display = "none";
alert(
'Please select at least one commitment to publish.');
return;
}
if ($checkedRecords.length > 0) {
//get the parent <tr> - the grid row as jQuery object
var $tr = $('#CommitmentTemplateDetailsGrid :checked').closest('tr');
 
if ($('#chkAll')[0].checked == true) {
// if you want you can get the underlying DOM element
for (var row = 1; row < $checkedRecords.length; row++) {
var tr = $tr[row]; //then get whichever cell you want:
status = tr.cells[11].innerHTML;
 
if (status == "Published") {
document.getElementById(
'validationmessage').style.display = "none";
alert(
'Some of the commitments you have selected are already published. Please deselect those commitments before proceeding.');
CanPublish =
false;
break;
}
else if (status == "Inactive") {
document.getElementById(
'validationmessage').style.display = "none";
alert(
'Inactive commitments cannot be published');
CanPublish =
false;
break;
}
else {
CanPublish =
true;
}
}
}
else {
// if you want you can get the underlying DOM element
for (var row = 0; row < $checkedRecords.length; row++) {
var tr = $tr[row]; //then get whichever cell you want:
status = tr.cells[11].innerHTML;
 
if (status == "Published") {
document.getElementById(
'validationmessage').style.display = "none";
alert(
'Some of the commitments you have selected are already published. Please deselect those commitments before proceeding.');
CanPublish =
false;
break;
}
else if (status == "Inactive") {
document.getElementById(
'validationmessage').style.display = "none";
alert(
'Inactive commitments cannot be published');
CanPublish =
false;
break;
}
else {
CanPublish =
true;
}
}
}
}
if (CanPublish) {
//var OK = confirm("You are setting the selected commitments status to Publish. Once the commitment status has been set to publish, you will not be allowed to delete the commitment and you will not be able to change the title, accountabilities, execution plan and For Managers Only flag of the commitment.");
var OK = myMessageBox("Message from webpage", "You are setting the selected commitments status to Publish. Once the commitment status has been set to publish, you will not be allowed to delete the commitment and you will not be able to change the title, accountabilities, execution plan and For Managers Only flag of the commitment.", 1 + 256 + 4096);
if (OK == 1) {
//Hit the Controller method called as SetCommitments
document.getElementById(
'ImgLoading').style.visibility = "visible";
var str = String();
var manager = String();
var version = String();
if ($('#chkAll')[0].checked == true) {
for (var row = 1; row < $checkedRecords.length; row++) {
var $tr = $('#CommitmentTemplateDetailsGrid :checked').closest('tr');
var tr = $tr[row];
str = str +
',' + tr.cells[2].innerHTML.toString();
manager = manager +
',' + tr.cells[7].innerHTML.toString();
version = version +
',' + tr.cells[21].innerHTML;
}
}
else {
for (var row = 0; row < $checkedRecords.length; row++) {
var $tr = $('#CommitmentTemplateDetailsGrid :checked').closest('tr');
var tr = $tr[row];
str = str +
',' + tr.cells[2].innerHTML.toString();
manager = manager +
',' + tr.cells[7].innerHTML.toString();
version = version +
',' + tr.cells[21].innerHTML;
}
}
 
//Take the values from hidden variables for the grid to rebin after publish
var FinalList_hidden = document.getElementById('_chdNodes');
var mangerValue_hidden = document.getElementById('_mgrValue');
 
//Validate the manager
//Call the Grid update and save templates action to proceed
var treeView = $('#TreeView1').data('tTreeView');
var checkedNodes = $('#TreeView1 :checked').closest('.t-item');
var checkedValues = $.map(checkedNodes, function (node) {
return treeView.getItemValue(node);
})
var FinalList = checkedValues.toString();
var managerlen = manager.length;
var _flag;
if (managerlen > 1000) {
_flag =
true;
$.ajax({
type:
"GET",
url:
"/ManageCommitmentTemplate/ValidateSelectedManager",
dataType:
"",
data: { periodid: $(
"#PeroidData :selected").val(),
ManagerFilter: mangerValue_hidden.value,
//$("#txtmanager").val(),
Ids: str,
state:
'P',
manager:
'',
Version: version,
CallManAliases: _flag
},
success:
function (response) {
if((response.substr(0, 3) == "SUC"))
{
var grid = $('#CommitmentTemplateDetailsGrid').data('tGrid');
grid.rebind({ id: $(
"#PeroidData :selected").val(),
ManagerFilter: mangerValue_hidden.value,
//$("#txtmanager").val(),
TcheckedNodes: FinalList_hidden.value,
//FinalList,
Flag: 0,
Ids: str, state:
'', Version: version
});
document.getElementById(
'validationmessage').style.display = "";
document.getElementById(
'validationmessage').innerHTML = response;
window.status =
"";
}
else
{
alert(response);
document.getElementById(
'ImgLoading').style.visibility = "hidden";
}
},
error:
function (response) {
var message = response.responseText;
var firstIndex = message.indexOf("<title>");
var lastIndex = message.lastIndexOf("</title>");
var mess = message.substr(firstIndex, lastIndex);
var fs = mess.indexOf("E");
var SI = mess.lastIndexOf("Template");
var mess2 = mess.substr(fs, SI + 1);
if (mess2 != null) {
alert(mess2);
document.getElementById(
'ImgLoading').style.visibility = "hidden";
}
else {
alert(
"Timeout Exception");
document.getElementById(
'ImgLoading').style.visibility = "hidden";
}
}
});
}
else {
_flag =
false;
$.ajax({
type:
"GET",
url:
"/ManageCommitmentTemplate/ValidateSelectedManager",
dataType:
"",
data: { periodid: $(
"#PeroidData :selected").val(),
ManagerFilter: mangerValue_hidden.value,
//$("#txtmanager").val(),
Ids: str,
state:
'P',
manager: manager,
Version: version,
CallManAliases: _flag,
},
success:
function (response) {
if((response.substr(0, 3) == "SUC"))
{
var grid = $('#CommitmentTemplateDetailsGrid').data('tGrid');
grid.rebind({
id: $(
"#PeroidData :selected").val(),
ManagerFilter: mangerValue_hidden.value,
//$("#txtmanager").val(),
TcheckedNodes:FinalList_hidden.value,
// FinalList,
Flag: 0,
Ids: str, state:
'', Version: version
});
document.getElementById(
'validationmessage').style.display = "";
document.getElementById(
'validationmessage').innerHTML = response;
window.status =
"";
}
else
{
alert(response);
document.getElementById(
'ImgLoading').style.visibility = "hidden";
}
},
error:
function (response) {
var message = response.responseText;
var firstIndex = message.indexOf("<title>");
var lastIndex = message.lastIndexOf("</title>");
var mess = message.substr(firstIndex, lastIndex);
var fs = mess.indexOf("E");
var SI = mess.lastIndexOf("Template");
var mess2 = mess.substr(fs, SI + 1);
if (mess2 != null) {
alert(mess2);
document.getElementById(
'ImgLoading').style.visibility = "hidden";
}
else {
alert(
"Timeout Exception");
document.getElementById(
'ImgLoading').style.visibility = "hidden";
}
}
});
}
}
else {
// function () {
// $(this).confirm("close");
// }
}
}
});
});
Thanks,
Shilpa
