if (isError)
{
if (document.getElementById('TabContainer1_TabPanel2_formViewSamples_fileUpload')) {
var fileUpload = document.getElementById('TabContainer1_TabPanel2_formViewSamples_fileUpload');
fileUpload.focus();
}
}
}
It goesnt even get into the method and gives me the error.
First of all, it might help to know what your JavaScript is supposed to do or what you think it is going to do.
Secondly, what is _divUploadProgress, _divUploadMessage, _divFrame, etc? If they are page elements/controls, the correct way of accessing them to change/set the attributes are, for example, document.getElementById('_divUploadProgress').style.display = 'none'
Third, The easiest way to output your script from your VB code is:
Dim javaScript As String() = "photoUploadComplete('Files uploaded.', false);"
ClientScript.RegisterStartupScript(Me.[GetType](), "uploadNotifyScript", javaScript, true)
Setting the last argument in ClientScript.RegisterStartupScript to true adds the script tags to the JavaScript for you.
That is all well and good. but the error occurs on the thing and it says that the method i.e photoUploadComplete doesnt support this property or whatever. i dont get it.
I think that the error is saying that you can't do this: _divUploadProgress.style.display = 'none' which you can't do unless _divUploadProgress is a reference to the control instantiated by document.getElementById and not just the ID of the control which
in fact does not support a style property since it is a JavaScript String object.
If you can't or won't answer my questions, I can't help you any further.
the javascript injected from server side actually allows it to enter the photoUploadComplete function but it comes up with that syntax error on line 207
Because you've got 2 <script> tags. One on 206 and one on 208, one inside of the other.
If you use this overload ClientScript.RegisterStartupScript(Me.[GetType](), "uploadNotifyScript", javaScript, true) do NOT add your own <script> tags. That is what the 4th argument does for you.
aspd
Member
38 Points
525 Posts
i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 16, 2008 07:23 PM|LINK
Hi All.
I have a javascript method that goes like this:
function photoUploadComplete(message, isError)
{
clearPhotoUploadProgress();
if (_photoUploadProgressTimer)
{
clearTimeout(_photoUploadProgressTimer);
}
_divUploadProgress.style.display = 'none';
_divUploadMessage.style.display = 'none';
_divFrame.style.display = '';
if (message.length)
{
var color = (isError) ? '#ff0000' : '#008000';
_divUploadMessage.innerHTML = '<span style=\"color:' + color + '\;font-weight:bold">' + message + '</span>';
_divUploadMessage.style.display = '';
if (isError)
{
if (document.getElementById('TabContainer1_TabPanel2_formViewSamples_fileUpload')) {
var fileUpload = document.getElementById('TabContainer1_TabPanel2_formViewSamples_fileUpload');
fileUpload.focus();
}
}
}
It goesnt even get into the method and gives me the error.
I have this in my server side:
script = String.Format(SCRIPT_TEMPLATE, "Files uploaded.", "false")
ClientScript.RegisterStartupScript(Me.[GetType](), "uploadNotify", script)
and at the top i have:
Private Const SCRIPT_TEMPLATE As String = "<" + "script " + "type=""text/javascript"">window.parent.photoUploadComplete('{0}', {1});" + "<" + "/script" + ">"
Not sure what the cause of the error is.
Anyone got any idea?
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 16, 2008 11:49 PM|LINK
First of all, it might help to know what your JavaScript is supposed to do or what you think it is going to do.
Secondly, what is _divUploadProgress, _divUploadMessage, _divFrame, etc? If they are page elements/controls, the correct way of accessing them to change/set the attributes are, for example, document.getElementById('_divUploadProgress').style.display = 'none'
Third, The easiest way to output your script from your VB code is:
Dim javaScript As String() = "photoUploadComplete('Files uploaded.', false);"
ClientScript.RegisterStartupScript(Me.[GetType](), "uploadNotifyScript", javaScript, true)
Setting the last argument in ClientScript.RegisterStartupScript to true adds the script tags to the JavaScript for you.
NC...
aspd
Member
38 Points
525 Posts
Re: i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 17, 2008 12:22 AM|LINK
That is all well and good. but the error occurs on the thing and it says that the method i.e photoUploadComplete doesnt support this property or whatever. i dont get it.
aspd
Member
38 Points
525 Posts
Re: i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 17, 2008 12:42 AM|LINK
hi. i did what u said on the registerstartupscript thing and it got further. It now gives me an syntax on line 207 which is this:
line 206<script type="text/javascript">
line 207<!--
line 208<script type="text/javascript">window.parent.photoUploadComplete('Files uploaded.', false);</script>
document.getElementById('TabContainer1_TabPanel2_formViewSamples_ValidationSummaryUploadInsert').dispose = function() {
Array.remove(Page_ValidationSummaries, document.getElementById('TabContainer1_TabPanel2_formViewSamples_ValidationSummaryUploadInsert'));
}
// -->
</script>
If you notice this is where the javascript from server side gets injected in. not sure what the syntax error is tho.
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 17, 2008 12:42 AM|LINK
I think that the error is saying that you can't do this: _divUploadProgress.style.display = 'none' which you can't do unless _divUploadProgress is a reference to the control instantiated by document.getElementById and not just the ID of the control which in fact does not support a style property since it is a JavaScript String object.
If you can't or won't answer my questions, I can't help you any further.
NC...
aspd
Member
38 Points
525 Posts
Re: i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 17, 2008 12:57 AM|LINK
i have this line earlier
_divUploadMessage = document.getElementById('divUploadMessage');
so yes it is referenced
aspd
Member
38 Points
525 Posts
Re: i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 17, 2008 01:00 AM|LINK
the javascript injected from server side actually allows it to enter the photoUploadComplete function but it comes up with that syntax error on line 207
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: i get error: Microsoft JScript runtime error: Object doesn't support this property or method
Jul 17, 2008 11:43 AM|LINK
Because you've got 2 <script> tags. One on 206 and one on 208, one inside of the other.
If you use this overload ClientScript.RegisterStartupScript(Me.[GetType](), "uploadNotifyScript", javaScript, true) do NOT add your own <script> tags. That is what the 4th argument does for you.
NC...