ON PAGE LOAD WHEN GETACTIVITYLIST IS null and mode is create.
var arr = [];
var arractivity = [];
$(document).ready(function () {
var theme = getDemoTheme();
// create jqxTree
$("#jqxTree").jqxTree({ height: "400px", hasThreeStates: true, checkboxes: true, width: "330px", theme: theme });
$("#jqxCheckBox").jqxCheckBox({ width: "200px", height: "25px", checked: true, theme: theme });
if (document.getElementById('Mode').value == 'Create') {
alert('hi1');
$("#RoleName").val("");
$("#RoleDescription").val("");
$("#RoleStatus").val("");
alert('hi2');
}
else {
arractivity=new Array(@(Model.GetActivityList.Count));
@for (var i = 0; i < @Model.GetActivityList.Count; i++)
{
<text>
var index="@i";
var act ="@Model.GetActivityList[i].ACTIVITY_ID";
addElementToarractivityArray(act,index);
//alert(act);
</text>
}
var j;
for (j = 0; j < arractivity.length; ++j) {
var AvtivityId= (arractivity[j]);
alert(AvtivityId);
$('#jqxTree').jqxTree('checkItem', $("#"+AvtivityId)[0], true);
alert(AvtivityId);
}
}
});
on page load directly going in else block while if condition is true.please help. i am working in MVC. CSHTML PAGE