Hi Telerik,
I have a dynamically created Dock and its content is a chart. I load the content for the dock like so:
I need to be able to access the name of the control ClientSide.
I suspect it's something like this, but I'm not quite on:
The alert displays a dump of all the HTML in the dock. This does include the control I am looking for, but there would be some extremely heavy parsing necessary to isolate the string that I want from the HTML. I've attached to this post "html.png" which is the output of the alert.
If I could just get the img id instead of all the HTML I would be happier, but I would be happiest if I could capture the control name without any parsing, obviously. Ultimately, my goal is to utilize some jQuery to resize the chart control stored on the RadDock. Just to make sure I'm not headed down a dark path, I would also just like to get a quick, "Yep. That should work!" from you guys.
So, this code isn't 100% relevant to what I've got going on, yet. This function waits for the window to be resized and then resizes Chart based on the new window size. I am going to rewrite this so that whenever the size of the Dock changes the content it controls (a chart) will resize to fill the size of the dock. Chart doesn't just exist on the page, though. I have to get a handle on that -- which means I need to get the control name from the Dock.
Let me know if anything here is unclear.
Thanks,
Sean
I have a dynamically created Dock and its content is a chart. I load the content for the dock like so:
private
void
LoadDockContent(RadDock dock)
{
System.Web.UI.Control ctrl = Page.LoadControl(
"PowerUsage.ascx"
);
dock.ContentContainer.Controls.Add(ctrl);
}
I need to be able to access the name of the control ClientSide.
I suspect it's something like this, but I'm not quite on:
<
script
type
=
"text/javascript"
>
function OnClientInitialize(dock, args) {
var content = dock.get_contentContainer();
var control = $telerik.isIE ? content.childNodes[0].innerHTML : content.childNodes[1].innerHTML;
alert(control);
}
</
script
>
The alert displays a dump of all the HTML in the dock. This does include the control I am looking for, but there would be some extremely heavy parsing necessary to isolate the string that I want from the HTML. I've attached to this post "html.png" which is the output of the alert.
If I could just get the img id instead of all the HTML I would be happier, but I would be happiest if I could capture the control name without any parsing, obviously. Ultimately, my goal is to utilize some jQuery to resize the chart control stored on the RadDock. Just to make sure I'm not headed down a dark path, I would also just like to get a quick, "Yep. That should work!" from you guys.
<
script
type
=
"text/javascript"
>
jQuery(function($) {
$(window).wresize(SetPageChartSizes<%= Chart.ClientID %>);
SetPageChartSizes<%= Chart.ClientID %>();
});
function SetPageChartSizes<%= Chart.ClientID %>() {
document.getElementById('<%= hfChartWidth.ClientID %>').value = (document.getElementById('<%= updatePanel.ClientID %>').offsetWidth - 4);
<%=Page.GetPostBackEventReference(btnHidden_Charts)%>;
}
</
script
>
So, this code isn't 100% relevant to what I've got going on, yet. This function waits for the window to be resized and then resizes Chart based on the new window size. I am going to rewrite this so that whenever the size of the Dock changes the content it controls (a chart) will resize to fill the size of the dock. Chart doesn't just exist on the page, though. I have to get a handle on that -- which means I need to get the control name from the Dock.
Let me know if anything here is unclear.
Thanks,
Sean