This is a migrated thread and some comments may be shown as answers.

[Solved] Telerik grid with Jquery not working in Azure cloud

3 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Arava
Top achievements
Rank 1
Arava asked on 21 Oct 2011, 08:11 AM
Hi Team,
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


3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Oct 2011, 08:42 AM
Hi Shilpa,

I don't see anything extraordinary in your code. What do you mean by "does not work over there" - is any Javascript executed at all? Do you receive Javascript errors?

My assumption is that your IE security settigns are too restrictive and the problem is exhibited only on your machine. Try resetting your browser settings to the defaults or test on other computers that have IE browser settings at a standard security level. You may also check whether all Javascript resources are loaded successfully.

All the best,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Arava
Top achievements
Rank 1
answered on 21 Oct 2011, 10:01 AM
i dont get any script errors , but some how the validations are alos not happeing. Like if ststaus i sk laready publishes , still it is trying to publish the.The validation messages whcih i have written are not working.
This is not happening in my local. it is happening only in cloud environment.
And one more thing, this cript is properly executing when i add the cloud site to trusted sites. other wise it is not working.
not sure  whther jquery or telerik is causing this problem.

Please help us.

Thanks ,
Shilpa
0
Dimo
Telerik team
answered on 21 Oct 2011, 01:30 PM
Hello Shilpa,

Based on the provided information, I still think the problem is caused by browser settings. If you have any additional related information, let us know.

Greetings,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Arava
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Arava
Top achievements
Rank 1
Share this question
or