如何为 Asp.Net Ajax 设置 Telerik RadChart 的百分比宽度?

发布于 2024-12-22 00:37:57 字数 57 浏览 5 评论 0原文

如何将 Telerik for asp ajax 的 RadChart 的大小调整为屏幕的整个宽度?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灯角 2024-12-29 00:37:57

我在 Telerik 论坛上发现有人打开包含您的 RadChart 的全屏弹出窗口。

看看最后,有一些可用的代码: Telerik 论坛

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

梦过后 2024-12-29 00:37:57

这就是我想出的,它对我来说效果很好

服务器上的 C# 代码

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

html 和客户端上的 javascript

<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>

我还在 Telerik 的网站上找到了这个链接,采用了另一种方法
链接

LaGrandMere,感谢您的帮助,但提供的链接并没有真正解决 mu 问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文