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

How to set behavior server-side for dynamic docks

3 Answers 63 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Trey Shaffer
Top achievements
Rank 1
Trey Shaffer asked on 21 Oct 2008, 09:39 PM
I'm creating some dynamic docks using server-side code, and I'm having an issue trying to set the behavior property.

If I want a dock to have pin, close, collapse, but also be resizable then I set the behavior like this:

<rad:RadDockableObject id="myObject" runat="server" text="The title" behavior="Close, Collapse, Pin, Resize" />

If I do it in server code, I am not given a collection to modify.  I can only set one of those properties using the RadDockableObjectBehaviorFlags.

How do I set all of these properties?

The closest I can get is using commands:
SomeDock.Commands.Add(new RadDockableObjectCommand("Close"))
SomeDock.Commands.Add(new RadDockableObjectCommand("Collapse"))
SomeDock.Commands.Add(new RadDockableObjectCommand("Pin"))

But if I do this, whenever I pin an object the pin command dissapears and I cannot unpin it!

Seems like a bug perhaps or perhaps programmer error on my part?

Does anyone have a working example for me?

joe

3 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 22 Oct 2008, 10:30 AM
Hi Trey Shaffer,
Here is the way of setting these properties in server-side code.

SomeDock.Commands.Add(new DockCloseCommand());
SomeDock.Commands.Add(new DockExpandCollapseCommand());
SomeDock.Commands.Add(new DockPinUnpinCommand());
SomeDock.Resizable = true;



Kind regards,
Stanimir
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Trey Shaffer
Top achievements
Rank 1
answered on 24 Oct 2008, 04:18 PM
Hello Telerik.  Thanks for the example.  What version of the controls is this functionality available in?

When I try and set those properties on my RadDockableObject instance named oDock, I am given some errors.

I set them like this but I am receiving errors: 

 

RadDockableObject oDock = new RadDockableObject();
string GadgetName = "Calendar";
string GadgetID =
"gadgetCalendar";
Control oCtl = LoadControl(
"Controls/Calendar.ascx");

 

oDock.Resizable =

true;
oDock.Commands.Add(
new DockCloseCommand());
oDock.Commands.Add(
new DockExpandCollapseCommand());
oDock.Commands.Add(
new DockPinUnpinCommand());
oDock.Text = GadgetName;
oDock.ID = GadgetID;

 

oDock.Container.Controls.Add(oCtl);

And then I add them to the zone.

The problem is I get these errors (below): 

I have Q1 2008 installed.  Do I need to get Q2?  My assembly version for RadDock is 1.8.8.0 and it's 180,224 bytes on disk.

thanks,
Joseph

Errors:
Error 1 'Telerik.WebControls.RadDockableObject' does not contain a definition for 'Resizable' C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 86 23 C:\...\TestTelerik\

Error 2 The type or namespace name 'DockCloseCommand' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 87 40 C:\...\TestTelerik\

Error 3 The best overloaded method match for 'Telerik.WebControls.RadDockableObjectCommandList.Add(Telerik.WebControls.RadDockableObjectCommand)' has some invalid arguments C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 87 17 C:\...\TestTelerik\

Error 4 Argument '1': cannot convert from 'DockCloseCommand' to 'Telerik.WebControls.RadDockableObjectCommand' C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 87 36 C:\...\TestTelerik\

Error 5 The type or namespace name 'DockExpandCollapseCommand' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 88 40 C:\...\TestTelerik\

Error 6 The best overloaded method match for 'Telerik.WebControls.RadDockableObjectCommandList.Add(Telerik.WebControls.RadDockableObjectCommand)' has some invalid arguments C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 88 17 C:\...\TestTelerik\

Error 7 Argument '1': cannot convert from 'DockExpandCollapseCommand' to 'Telerik.WebControls.RadDockableObjectCommand' C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 88 36 C:\...\TestTelerik\

Error 8 The type or namespace name 'DockPinUnpinCommand' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005
\WebSites\TestTelerik\PortalPage.aspx.cs 89 40 C:\...\TestTelerik\

Error 9 The best overloaded method match for 'Telerik.WebControls.RadDockableObjectCommandList.Add(Telerik.WebControls.RadDockableObjectCommand)' has some invalid arguments C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 89 17 C:\...\TestTelerik\

Error 10 Argument '1': cannot convert from 'DockPinUnpinCommand' to 'Telerik.WebControls.RadDockableObjectCommand' C:\Documents and Settings\jjohnson\My Documents\Visual Studio 2005\WebSites\TestTelerik\PortalPage.aspx.cs 89 36 C:\...\TestTelerik\

0
Joseph
Top achievements
Rank 1
answered on 24 Oct 2008, 06:02 PM
Nevermind, I just realized that I was not using the correct versio nof Telerik.  I need to use the prometheus version which has telerik.web.ui.dll

My apologies!

This would explain why not the examples I was encountering would work with my setup :-)

BTW my apologies for changing names here, I was logged in on the wrong email address (of a coworker).

I will try your example on the correct version of Telerik.web.ui.dll and I'm sure it will work.

Much obliged,
joseph
Tags
Dock
Asked by
Trey Shaffer
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Trey Shaffer
Top achievements
Rank 1
Joseph
Top achievements
Rank 1
Share this question
or