I have a javascript function on a Webform which I call from code behind like below. It works fine without the RadAjaxManager.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
As soon as I add the script manager and fire the javascript, I get an error in the DOM saying:
JavaScript critical error at line 343, column 42 in http://localhost:32135/3DPrototypeQuote.aspx\n\nSCRIPT1004: Expected ';'
Note there is a semicolon missing between NovaCopyStlViewer('/assets/Inverted.stl') and Sys.Application.add_init(function()) , here is where the Visual Studio is telling me there is a semi colon missing.
<script type="text/javascript">
//<![CDATA[
NovaCopyStlViewer('/assets/Inverted.stl')Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadAjaxManager, {"_updatePanels":"","ajaxSettings":[],"clientEvents":{OnRequestStart:"",OnResponseEnd:""},"defaultLoadingPanelID":"","enableAJAX":true,"enableHistory":false,"links":[],"styles":[],"uniqueID":"ctl00$ContentPlaceHolder1$RadAjaxManager1","updatePanelsRenderMode":0}, null, null, $get("ctl00_ContentPlaceHolder1_RadAjaxManager1"));
});
//]]>
</script>
try
{
FileUpload fileUpload = FileUploadControl;
string physicalFolder = Server.MapPath("~/assets/");
if (fileUpload.HasFile)
{
string uploadFile = physicalFolder + fileUpload.FileName;
fileUpload.SaveAs(uploadFile);
string testFile = "/assets/" + fileUpload.FileName;
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "NovaCopyStlViewer('" + testFile + "')", true);
}
}
catch (Exception)
{
throw;
}
<script type="text/javascript">
function NovaCopyStlViewer(file)
{
var cv = document.getElementById('canvas_drop');
cv.style.display = 'block';
var e = document.getElementById('select_options');
e.style.display = 'block';
var mycanvas = document.getElementById('upload_canvas');
var viewer = new JSC3D.Viewer(mycanvas);
var theScene = new JSC3D.Scene;
var stlpath = file;
viewer.setParameter('SceneUrl', stlpath);
viewer.setParameter('InitRotationX', 20);
viewer.setParameter('InitRotationY', 20);
viewer.setParameter('InitRotationZ', 0);
viewer.init();
viewer.update();
}
</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
As soon as I add the script manager and fire the javascript, I get an error in the DOM saying:
JavaScript critical error at line 343, column 42 in http://localhost:32135/3DPrototypeQuote.aspx\n\nSCRIPT1004: Expected ';'
Note there is a semicolon missing between NovaCopyStlViewer('/assets/Inverted.stl') and Sys.Application.add_init(function()) , here is where the Visual Studio is telling me there is a semi colon missing.
<script type="text/javascript">
//<![CDATA[
NovaCopyStlViewer('/assets/Inverted.stl')Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadAjaxManager, {"_updatePanels":"","ajaxSettings":[],"clientEvents":{OnRequestStart:"",OnResponseEnd:""},"defaultLoadingPanelID":"","enableAJAX":true,"enableHistory":false,"links":[],"styles":[],"uniqueID":"ctl00$ContentPlaceHolder1$RadAjaxManager1","updatePanelsRenderMode":0}, null, null, $get("ctl00_ContentPlaceHolder1_RadAjaxManager1"));
});
//]]>
</script>
try
{
FileUpload fileUpload = FileUploadControl;
string physicalFolder = Server.MapPath("~/assets/");
if (fileUpload.HasFile)
{
string uploadFile = physicalFolder + fileUpload.FileName;
fileUpload.SaveAs(uploadFile);
string testFile = "/assets/" + fileUpload.FileName;
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "NovaCopyStlViewer('" + testFile + "')", true);
}
}
catch (Exception)
{
throw;
}
<script type="text/javascript">
function NovaCopyStlViewer(file)
{
var cv = document.getElementById('canvas_drop');
cv.style.display = 'block';
var e = document.getElementById('select_options');
e.style.display = 'block';
var mycanvas = document.getElementById('upload_canvas');
var viewer = new JSC3D.Viewer(mycanvas);
var theScene = new JSC3D.Scene;
var stlpath = file;
viewer.setParameter('SceneUrl', stlpath);
viewer.setParameter('InitRotationX', 20);
viewer.setParameter('InitRotationY', 20);
viewer.setParameter('InitRotationZ', 0);
viewer.init();
viewer.update();
}
</script>