Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Value must not be null JavaScript errorValue must not be null JavaScript error
Previous
 
Next
New Post
10/17/2008 12:15 AM
 

Hi Folks,

I am getting an error with some JavaScript that is being inserted into a DNN module page at the server level. The module is AJAX enabled. The JavaScript ends with this.

// Register the class as a type that inherits from Sys.UI.Control.
IsAdminScptCntl.IsAdminObj.registerClass('IsAdminScptCntl.IsAdminObj', Sys.UI.Control);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();

I get this error:

Microsoft JScript runtime error: Sys.ArgumentException:Value must not be null for Controls and Behaviors. Parameter name: element

It looks like my registerClass statement generates this which I can see in the page source.

$create(IsAdminScptCntl.IsAdminObj, {"IsAdmin":false}, null, null, $get("dnn_ctr765_ViewSSCIMediaDataInt"));

That is where the debugger stops and gives the above error. DNN does create id’s on the fly, correct? I looked at the page source there are no id’s equal to dnn_ctr765_ViewSSCIMediaDataInt although there are ones like dnn_ctr765_ViewSSCIMediaDataInt_UpdPanelANFlash. I am not sure about all the nuances of the DNN and JavaScript interaction. Can someone suggest what is happening and how I can fix this. If dnn_ctr765_ViewSSCIMediaDataInt isn't the correct element id how do I find it?

Thanks,
G.M.

 
New Post
10/17/2008 9:05 AM
 

You're using the Ajax Control Toolkit, and you must disable the extender when the control you're using is not visible.

 

if (MyExtendedControl.Visible = false) Then

MyExtender.Enabled = false

end if

 
New Post
10/19/2008 11:45 PM
 
samyb wrote 

You're using the Ajax Control Toolkit, and you must disable the extender when the control you're using is not visible. 

if (MyExtendedControl.Visible = false) Then

MyExtender.Enabled = false

end if

Hi samyb,
 
Thanks for the reply. Excuse my lack of understanding but I am new to inserting JavaScript objects via the AJAX GetScriptDescriptors() method. You indicate that this has to be done in the code behind? It isn’t clear to me how I determine what the id’s of MyExtendedControl and MyExtendedControl are in your example. The ClientID is equal to dnn_ctr765_ViewSSCIMediaDataInt. Would dnn_ctr765_ViewSSCIMediaDataInt be "MyExtendedControl"? Me.FindControl(Me.ClientID) results in null or nothing.
 
Thanks,
G.M.
 
My JavaScript is inserted from a file called IsAdminScptCntl.js via the following:

   Protected Overridable Function GetScriptReferences() As IEnumerable(Of ScriptReference)

 
            Dim reference As ScriptReference = New ScriptReference()
            reference.Path = "~/DesktopModules/SSCIMediaDataInt/jsMthds/IsAdminScptCntl.js"
 
            Return New ScriptReference() {reference}
  
        End Function
 
        Protected Overridable Function GetScriptDescriptors() As IEnumerable(Of ScriptDescriptor)
 
            Dim descriptor As ScriptControlDescriptor = New ScriptControlDescriptor("IsAdminScptCntl.IsAdminObj", Me.ClientID)
            descriptor.AddProperty("IsAdmin", Me.IsAdmin)
 
            Return New ScriptDescriptor() {descriptor}
 
        End Function

 

 
New Post
10/20/2008 4:04 AM
 

If i understand correctly what you're saying, the  method $get('dnn_ctr765_ViewSSCIMediaDataInt') return null. That would likely mean that this control is not on the page, which is the case when it's not rendered. So, at render time, the Visible property of the control or one of its parents is false.

When you're running your javascript, you try to reference this control via the $get method, but since the framework can't find the controls, it warns you about passing a null object to the framework, hence the message.

You should link the javascript you include to the visibility/availability of your control. My best guess would be to put a breakpoint in the prerender or render methods and on the javascript inclusion to confirm that both are not synchronized.

Keep us posted

 
New Post
10/21/2008 12:38 PM
 

samyb wrote
 

If i understand correctly what you're saying, the  method $get('dnn_ctr765_ViewSSCIMediaDataInt') return null. That would likely mean that this control is not on the page, which is the case when it's not rendered. So, at render time, the Visible property of the control or one of its parents is false.

When you're running your javascript, you try to reference this control via the $get method, but since the framework can't find the controls, it warns you about passing a null object to the framework, hence the message.

You should link the javascript you include to the visibility/availability of your control. My best guess would be to put a breakpoint in the prerender or render methods and on the javascript inclusion to confirm that both are not synchronized.

Keep us posted

Thanks Samyb, I will set that breakpoint and see what I can determine. I am also going to reread some of the stuff I consulted to build this code. There may be something I missed or something that will give me a clue about why it might have a problem in a DNN environment.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Value must not be null JavaScript errorValue must not be null JavaScript error


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out