VB Examples don't work

5 posts, 0 answers
  1. Aron Calder
    Aron Calder avatar
    13 posts
    Member since:
    Jan 2006

    Posted 05 May 2007 Link to this post

    Hi Telerik,

    The vb.net examples for Dynamically Created Docks and My Portal don't work and give a script error.

    C# examples work fine.

    Has anyone managed to get the dynamic adding of docks to work with vb.net?

    Many thanks

    Aron
  2. surfer
    surfer avatar
    585 posts
    Member since:
    Jul 2003

    Posted 05 May 2007 Link to this post

    Yep, same problems here, the VB.NET example shows a javascript error:

    $find("RadDockZone1").Dock is not a function

    I believe the problem is related to automatic translation from C# to VB.NET, possibly using telerik's converter tool, because for simple increment is uses a complex conversion form, e.g.

    System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)

    which is a problem with the telerik code converter shown in this forum thread:
    http://www.telerik.com/community/forums/thread/b311D-tmhat.aspx

    In any case, I believe the only thing that is wrongly converted is the javascript registered with RegisterStartupScript. Replacing the generated string with

    Dim s As String = "Sys.Application.add_load(function() { if (typeof(Telerik.Dock{0}Moved) === 'undefined')  {  $find('{1}').dock($find('{0}'));  Telerik.Dock{0}Moved = true;  }});" 
     
    ScriptManager.RegisterStartupScript(UpdatePanel1, GetType(RadDock), "DockIntoZone"String.Format(s, dock.ClientID, RadDockZone1.ClientID), True

    should address the problem.
  3. Aron Calder
    Aron Calder avatar
    13 posts
    Member since:
    Jan 2006

    Posted 05 May 2007 Link to this post

    Thanks for the quick response surfer, still doesn't work unforunately.

    Now get a "System.FormatException - Input string was not in a correct format."

    Cheers

    Aron
  4. Aron Calder
    Aron Calder avatar
    13 posts
    Member since:
    Jan 2006

    Posted 05 May 2007 Link to this post

    Problem solved!

    "$find('{1}').Dock($find('{0}')); 

    should read

    "$find('{1}').dock($find('{0}'));" 

    Just needed a lowercase 'd' on the word 'dock'

    Therefore full code line:

                ScriptManager.RegisterStartupScript(UpdatePanel1, GetType(RadDock), "DockIntoZone", String.Format("" & Chr(13) & "" & Chr(10) & "Sys.Application.add_load(function() {{" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "if (typeof(Telerik.Dock{0}Moved) === 'undefined')" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "{{" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "" & Chr(9) & "$find('{1}').dock($find('{0}'));" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "" & Chr(9) & "Telerik.Dock{0}Moved = true;" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "}}" & Chr(13) & "" & Chr(10) & "}});", dock.ClientID, DropDownZone.SelectedValue), True)  
     

    Cheers

    Aron
  5. Petya
    Admin
    Petya avatar
    869 posts

    Posted 07 May 2007 Link to this post

    Hi,

    Thank you for pointing out this issue to us. The examples will soon be fixed.

    Kind regards,
    Petya
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top