title: Javascript Observable collection count
body: <p>I'm, accessing Silverlight ObservableCollection count in javascript, but I get the following error.,</p>
  
  <pre><code>Microsoft JScript runtime error: System.FormatException: Input string was not in a correct format.
     at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&amp; number, NumberFormatInfo info, Boolean parseDecimal)
     at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
     at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
     at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
     at System.Windows.Hosting.ScriptingInterface.GetScriptParamValueForType(ScriptParam scriptParam, Type desiredType)
     at System.Windows.Hosting.ScriptingInterface.ConvertFromScriptParams(Type[] desiredTypes, ScriptParam[] args)
     at System.Windows.Browser.ManagedObjectInfo.ListIndexerMember.Invoke(ManagedObject obj, InvokeType invokeType, ScriptParam[] args)
     at System.Windows.Browser.ManagedObjectInfo.Invoke(ManagedObject obj, InvokeType invokeType, String memberName, ScriptParam[] args)
     at System.Windows.Hosting.ManagedHost.InvokeScriptableMember(IntPtr pHandle, Int32 nMemberID, Int32 nInvokeType, Int32 nArgCount, ScriptParam[] pArgs, ScriptParam&amp; pResult, ExceptionInfo&amp; pExcepInfo)
  </code></pre>
  
  <p>I'm using following code, where children is a observablecollection of custom object.,</p>
  
  <pre><code>            reg.OnDropping = function (sender, args) {
                  if (args.toItem.Children.Count &gt; 0) {
                      args.cancel = true;
                  }
                  else {
                      args.cancel = false;
                  }
              }
  </code></pre>
  
  <p>Is there any other way to access the count in Javascript?</p>
  
  <p>Regards,
  Karthik</p>