Question

How can I resize the RadChart of Telerik for asp ajax to the full width of the screen?

Was it helpful?

Solution 2

This is what I came up with and it works fine for me

C# code on the server

    public void buttonUpdate_Click(object sender, EventArgs args)
    {
        this.radChart1.Visible = true;
        this.radChart1.Width = Int32.Parse(this.hiddenFieldWidthInPixels.Value);
    }

html and javascript on the client

<asp:UpdatePanel runat="server" ID="updatePanel" OnLoad="wtf" UpdateMode="Conditional">
        <ContentTemplate>
            <panel>    
                <asp:Button runat="server" ID="buttonUpdate" style="width:80%; height:10%; visibility: collapse; "  Text="This is the update button and should not be visible" OnClick="buttonUpdate_Click" /> 
                <asp:HiddenField runat="server" ID="hiddenFieldWidthInPixels" /> 
                <telerik:RadChart runat="server" ID="radChart1" Visible="false" />                         
            </panel>
        </ContentTemplate>
</asp:UpdatePanel>

    <script type="text/javascript">

        function getASPElm(nm) {
            if ($get(nm)) return $get(nm);

            var e = document.getElementsByTagName('*');
            for (var i = 0; i < e.length; i++) {
                if (e[i].id) {
                    if (e[i].id.indexOf(nm) != -1) return e[i];
                }
            }

            return null;
            //http://forums.asp.net/t/1107047.aspx/1
        }

        var buttonUpdate = getASPElm('buttonUpdate');
        var hiddenField = getASPElm('hiddenFieldWidthInPixels');
        hiddenField.value = buttonUpdate.style.pixelWidth;

        buttonUpdate.click();
    </script>

And I also found this link on Telerik's site with another approach link

LaGrandMere, thanks for the help, but the provided link did not really address mu issue.

OTHER TIPS

I found on the Telerik forum someone who opens a popup full screen containing your RadChart.

Look at the end, there is some code available : Telerik Forum

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top