I want to Trigger ASP.Net button Or call ASP.NET function using external JavaScript ".js" file.
I am currently using the following code but it failed.
function setXMLAnnotationsData(xmlAnnotData) {
debugger;
document.getElementById('txtAnnotationsXMLData').value = xmlAnnotData;
var txtAnnotationsXMLData = window.parent.frames[2].document.getElementById('txtAnnotationsXMLData');
if (txtAnnotationsXMLData) {
txtAnnotationsXMLData.value = xmlAnnotData;
}
window.parent.frames[2].document.getElementById('txtHHNo').value = window.parent.document.getElementById("txtHHNO").value;
var btnSaveRecord = window.parent.frames[2].document.getElementById('btnSaveRecord');
if (btnSaveRecord) {
btnSaveRecord.click(); //**Here I want to Perform This click**
$.ajax({
type: "POST",
url: '/frmSaveAnnotation.aspx/test',
data: { jsonData: "testing" },
dataType: "json",
success: successFunc,
error: errorFunc
});
}
var btnAntSearch = ObjTreePage.getElementById('btnAntSearch');
if (btnAntSearch) {
btnAntSearch.click();
document.getElementById('<%= btnSaveRecord.ClientID %>').click();
}
return;
}
I am using button ID is btnSaveRecord in My ASPX file