This is a migrated thread and some comments may be shown as answers.

VB Examples don't work

4 Answers 119 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Aron Calder
Top achievements
Rank 1
Aron Calder asked on 05 May 2007, 10:54 AM
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

4 Answers, 1 is accepted

Sort by
0
surfer
Top achievements
Rank 1
answered on 05 May 2007, 11:33 AM
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.
0
Aron Calder
Top achievements
Rank 1
answered on 05 May 2007, 02:47 PM
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
0
Aron Calder
Top achievements
Rank 1
answered on 05 May 2007, 03:44 PM
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
0
Petya
Telerik team
answered on 07 May 2007, 07:13 AM
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
Tags
Dock
Asked by
Aron Calder
Top achievements
Rank 1
Answers by
surfer
Top achievements
Rank 1
Aron Calder
Top achievements
Rank 1
Petya
Telerik team
Share this question
or