I have a Rad Dock on a page. I need it to be positioned in a certain place on the page (in the top-right corner of a Panel, i.e. <div>).
Since actual coordinates and size of the panel are not available on the server side, I'm trying to set up a client script that moves a RadDock to the required position right after the page is loaded.
This might be relevant to the problem: I do not have RadDockLayout and RadDockZone on the page. I use master page.
What I have in aspx (I omitted some unrelated elements):
What I did:
I wrote a JavaScript function to position the dock:
In codebehind (OnInit) I attach the client function to the page:
The client function starts as expected, but $find(DockId.id) always returns null.
How to make all this work?
Since actual coordinates and size of the panel are not available on the server side, I'm trying to set up a client script that moves a RadDock to the required position right after the page is loaded.
This might be relevant to the problem: I do not have RadDockLayout and RadDockZone on the page. I use master page.
What I have in aspx (I omitted some unrelated elements):
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server"> |
<asp:Panel runat="server" id="RequestFormPanel" BackColor="Green" > |
<asp:Panel runat="server" ID="requestPanel" CssClass="FormPanel" BackColor="Red" > |
</asp:Panel> |
<telerik:RadDock runat="server" ID="IRItemListDock" Title="Информационные ресурсы" EnableAnimation="true" Visible="false" DefaultCommands = "ExpandCollapse" > |
<ContentTemplate> |
<uc2:IRItemList ID="IRItemList1" runat="server" /> |
</ContentTemplate> |
</telerik:RadDock> |
</asp:Panel> |
</asp:Content> |
What I did:
I wrote a JavaScript function to position the dock:
function MoveDock(DockId, PanelId) |
{ |
var currentDock = $find(DockId.id); |
if ( currentDock == null ) { return; } |
obj = document.getElementById(PanelId.id); |
var x = 0; |
var y = 0; |
while (obj != null) |
{ |
x += obj.offsetLeft; |
y += obj.offsetTop; |
} |
currentDock.set_left(x); |
currentDock.set_top(y); |
} |
In codebehind (OnInit) I attach the client function to the page:
Page.RegisterStartupScript("Startup", "<script language=JavaScript>MoveDock(" + IRItemListDock.ClientID + "," + requestPanel.ClientID + ");</script>"); |
The client function starts as expected, but $find(DockId.id) always returns null.
How to make all this work?