string clientscrpt = "javascript:loadclientdet();";
clientscrpt+="loadCi('" + dt.Rows[0]["ciid"].ToString() + "');";
clientscrpt+="loadTeam('"+assignedTeamId +"');";
clientscrpt+="loadEmpName('drpicassignedgroup','drpicassigneename','"+dt.Rows[0]["assigned_empid"].ToString() +"');";
clientscrpt+="loadEmpdet('drpicassigneename','txticassigneemail','txticassigneedepartment','txticassigneemobile','txticassigneedesignation');";
clientscrpt+="loadEmpName('drpiccoordinatorgroup','drpiccoordinatorname','"+dt.Rows[0]["coordinator_empid"].ToString() +"');";
clientscrpt+="loadEmpdet('drpiccoordinatorname','txticcoordinatoremail','txticcoordinatordepartment','txticcoordinatormobile','txticcoordinatordesignation');";
ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", clientscrpt, true);
I want to fire the functions orderly.For example,
loadci()
function is to load details of items.
function loadCi(ciidselect) {
try {
var catid = $("#drpiccategory").val();
var envid = $("#drpicenvironment").val();
var rest = $('#drpAffectedCI');
$("#hiddenAffectedCiValue").val('');
$.ajax({
type: "POST",
url: "incidentnewform.aspx/loadCIFiltered",
data: JSON.stringify({ catid: catid, envid: envid }),
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function () {
rest.append("<option>Loading...</option>");
},
success: function (data) {
rest.empty();
$.each(data.d, function (index, item) {
rest.append("<option value='" + item.split('~')[0] + "'>" + item.split('~')[1] + "</option>");
});
if (ciidselect != "") {
$('#drpAffectedCI').val(ciidselect);
}
},
failure: function (response) {
alert("Some error occurred...");
}
});
}
catch (e) {
alert("Error occurred..");
}
}
When CI is not fully loaded the next function loadTeam() is fired. I want to load the loadtem() after loadci() onsuccess is called i.e. loadci() completed. when the CI is at beforeSend test the function loadTeam() gets fired.
How to do it with registerstartupscript?
I can not fire the functions in the json onsucess itself one by one due to some reason.
loadci()
{
onsuccess:function(data)
{
loadteam();
}
}
I hope I can make understand.